Skip to content

Commit 0aeddd5

Browse files
committed
Fixed usage of application/xml overriding to not conflict with JSON responses
Signed-off-by: Mike Raineri <michael.raineri@dell.com>
1 parent 6ef9999 commit 0aeddd5

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

emulator.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,6 @@ def error_response(msg, status, jsonify=False):
124124
class PathError(Exception):
125125
pass
126126

127-
@g.api.representation('application/xml')
128-
def output_xml(data, code, headers=None):
129-
resp = make_response(data, code)
130-
resp.headers.extend(headers or {})
131-
resp.headers['Content-Type'] = 'text/xml; charset=ISO-8859-1'
132-
return resp
133-
134127
@g.api.representation('application/json')
135128
def output_json(data, code, headers=None):
136129
"""
@@ -352,7 +345,7 @@ def serviceInfo():
352345
def browse():
353346
return render_template('browse.html')
354347

355-
# Return metadata as type text/xml
348+
# Return metadata as type application/xml
356349
@g.app.route('/redfish/v1/$metadata')
357350
def get_metadata():
358351
logging.info ('In get_metadata')
@@ -365,7 +358,8 @@ def get_metadata():
365358
filename = 'Resources/$metadata/index.xml'
366359
else:
367360
# Use static mockup
368-
mockup_path = MOCKUPFOLDERS[0]
361+
# Static resource loader relies on the folder to be lower case, but inspects it based on the capitalization...
362+
mockup_path = MOCKUPFOLDERS[0].lower()
369363
filename = os.path.join("api_emulator", mockup_path, 'static', '$metadata', 'index.xml')
370364

371365
with open(filename, 'r') as var:
@@ -374,7 +368,7 @@ def get_metadata():
374368
md_xml += line
375369

376370
resp = make_response(md_xml, 200)
377-
resp.headers['Content-Type'] = 'text/xml'
371+
resp.headers['Content-Type'] = 'application/xml'
378372
return resp
379373

380374
except Exception:

0 commit comments

Comments
 (0)