Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Second thoughts on mime type

After further review, changing the mime type on jsonp
responses from text/javascript to application/javascript,
with a hat-tip to
  • Loading branch information...
1 parent 27194a0 commit 68f93634de2e25afda209b710002e4c9159fd38e @njl committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 flask/
4 flask/
@@ -121,7 +121,7 @@ def get_current_user():
.. versionadded:: 0.9
If the ``padded`` argument is true, the JSON object will be padded
for JSONP calls and the response mimetype will be changed to
- ``text/javascript``. By default, the request arguments ``callback``
+ ``application/javascript``. By default, the request arguments ``callback``
and ``jsonp`` will be used as the name for the callback function.
This will work with jQuery and most other JavaScript libraries
by default.
@@ -141,7 +141,7 @@ def get_current_user():
del kwargs['padded']
json_str = json.dumps(dict(*args, **kwargs), indent=None)
content = str(callback) + "(" + json_str + ")"
- return current_app.response_class(content, mimetype='text/javascript')
+ return current_app.response_class(content, mimetype='application/javascript')
return current_app.response_class(json.dumps(dict(*args, **kwargs),
indent=None if request.is_xhr else 2), mimetype='application/json')

0 comments on commit 68f9363

Please sign in to comment.
Something went wrong with that request. Please try again.