Add JSONIFY_MIMETYPE configuration variable (#1728)

Allow jsonify responses' mimetype to be configured
This commit is contained in:
Steven Loria 2016-04-08 19:30:47 -03:00 committed by David Lord
parent 0690ce18c2
commit 2bf477cfea
5 changed files with 16 additions and 1 deletions

View file

@ -1019,6 +1019,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'})
with app.test_request_context():
msg = {
"msg": {"submsg": "W00t"},
}
rv = flask.make_response(
flask.jsonify(msg), 200)
assert rv.mimetype == 'application/vnd.api+json'
def test_url_generation():
app = flask.Flask(__name__)