Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JSONIFY_MIMETYPE configuration variable #1728

Merged
merged 1 commit into from Apr 8, 2016

Conversation

@sloria
Copy link
Contributor

commented Feb 16, 2016

It is often useful to be able to return a vendor media type for JSON responses. For example, JSON API requires that all responses have the Content-Type: applications/vnd.api+json header.

@@ -1029,6 +1029,18 @@ def test_jsonify_prettyprint():
assert rv.data == pretty_response


def test_jsonify_mimetype():
app = flask.Flask(__name__)
app.config.update({"JSONIFY_MIMETYPE": 'application/vnd.api+json'})

This comment has been minimized.

Copy link
@ThiefMaster

ThiefMaster Feb 16, 2016

Member

why not just app.config['JSONIFY_MIMETYPE'] = '...'?

This comment has been minimized.

Copy link
@sloria

sloria Feb 18, 2016

Author Contributor

I am following the conventions used in similar tests. For example: https://github.com/mitsuhiko/flask/pull/1728/files#diff-9e9ddedef65dec3da86063a067839e65R1021

@@ -183,6 +183,7 @@ The following configuration values are used internally by Flask:
if they are not requested by an
XMLHttpRequest object (controlled by
the ``X-Requested-With`` header)
``JSONIFY_MIMETYPE`` Mimetype used for jsonify responses.

This comment has been minimized.

Copy link
@ThiefMaster

ThiefMaster Feb 16, 2016

Member

"MIME type"?

This comment has been minimized.

Copy link
@sloria

sloria Feb 18, 2016

Author Contributor

Good call. Fixed.

@sloria sloria force-pushed the sloria:jsonify-mimetype branch from 6afffdb to a3c574f Feb 18, 2016

@jeffwidman

This comment has been minimized.

Copy link
Member

commented Apr 8, 2016

LGTM

@untitaker

This comment has been minimized.

Copy link
Member

commented Apr 8, 2016

LGTM, but the changelog entry is now for the wrong version.

Add JSONIFY_MIMETYPE configuration variable
Allow jsonify responses' mimetype to be configured

@sloria sloria force-pushed the sloria:jsonify-mimetype branch from a3c574f to 2cfaf04 Apr 8, 2016

@sloria

This comment has been minimized.

Copy link
Contributor Author

commented Apr 8, 2016

OK, I've rebased with the latest master and put the changelog entry in the 1.0 section.

@davidism davidism merged commit 2bf477c into pallets:master Apr 8, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.