Commit 5121e9ab authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Change the content type based on the given format parameter.

parent 2f661aab
...@@ -73,7 +73,8 @@ class Catalog(Resource): ...@@ -73,7 +73,8 @@ class Catalog(Resource):
mapping = Mapping() mapping = Mapping()
mapping.map_catalog(es_response.hits) mapping.map_catalog(es_response.hits)
content_type = 'application/xml' if format_ == 'xml' else 'text/%s' % format_
return Response( return Response(
mapping.g.serialize(format=format_).decode('utf-8'), 200, mapping.g.serialize(format=format_).decode('utf-8'), 200,
{'Content-Type': 'application/xml'}) {'Content-Type': content_type})
...@@ -59,6 +59,7 @@ class Dataset(Resource): ...@@ -59,6 +59,7 @@ class Dataset(Resource):
mapping = Mapping() mapping = Mapping()
mapping.map_entry(entry) mapping.map_entry(entry)
content_type = 'application/xml' if format_ == 'xml' else 'text/%s' % format_
return Response( return Response(
mapping.g.serialize(format=format_).decode('utf-8'), 200, mapping.g.serialize(format=format_).decode('utf-8'), 200,
{'Content-Type': 'application/xml'}) {'Content-Type': content_type})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment