miLibris / flask-rest-jsonapi

Flask extension to build REST APIs around JSONAPI 1.0 specification.
http://flask-rest-jsonapi.readthedocs.io
MIT License
597 stars 153 forks source link

Multiple Content-Type headers on responses #99

Closed jhekkanen closed 5 years ago

jhekkanen commented 6 years ago

All responses from the Api seem to have multiple content-type headers. For example when running the minimal API example and requesting with curl:

< HTTP/1.0 200 OK
< Content-Type: application/json
< Content-Length: 155
< Content-Type: application/vnd.api+json
< Server: Werkzeug/0.14.1 Python/2.7.14

I believe this is caused by 8ca7a74b9e0a4c66c4408c31c1f8f285e6cadd74 as jsonify returns a new Response object with mimetype set to current_app.config['JSONIFY_MIMETYPE'] (defaults to 'application/json'). This object is then passed to make_response along with the correct content-type which ends up only extending the existing headers. Maybe use flask.json.dumps instead of flask.json.jsonify?

akira-dev commented 5 years ago

Fixed in 35933b7285d98081581e3ab0f63f916c7aa802d6