Skip to content
Snippets Groups Projects
Commit 5121e9ab authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Change the content type based on the given format parameter.

parent 2f661aab
No related branches found
No related tags found
3 merge requests!254Merging these two branches concerning the encylopedia complex search,!246Merge for release,!238Add dcat API for stream project.
...@@ -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})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment