-
Notifications
You must be signed in to change notification settings - Fork 889
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
Content-Type: application/json shouldn't have a charset parameter. #2860
Comments
What version of pyramid and webob are you using? This has been fixed but I can't remember if it's released yet (but I think it is). |
I'm using Thank you and sorry for the repost. |
That PR you linked was reverted in favor of another solution as it was backward incompatible. I'm thinking of Pylons/webob#197 which was released in webob 1.6.0. Here is a test case that passes. Can you update it to reproduce your issue? from pyramid.config import Configurator
from webtest import TestApp
def json_view(request):
return {}
config = Configurator()
config.add_view(json_view, renderer='json')
app = config.make_wsgi_app()
testapp = TestApp(app)
r = testapp.get('/')
assert r.content_type == 'application/json' |
If we assert from pyramid.config import Configurator
from webtest import TestApp
def json_view(request):
return {}
config = Configurator()
config.add_view(json_view, renderer='json')
app = config.make_wsgi_app()
testapp = TestApp(app)
r = testapp.get('/')
assert r.headers['Content-Type'] == 'application/json' |
Upgrading to webob 1.7.0rc1 fixes this, however it also emits a |
Pyramid changes from In the future WebOb will remove all Pyramid isn't doing anything wrong, WebOb is warning about changed behaviour that a user may not be expecting. |
Is there a way for pyramid to avoid this warning in the update? Obviously people are going to open more bugs in our tracker if every |
Although it sounds like I should modify it instead to be a DeprecationWarning and that won't be shown by default... |
Bypasses all of it, and does the right thing, and no warning will be emitted. It's because of the "magic" that |
This is now fixed in WebOb 1.7.0rc2 |
I'm trying to decide if it's worth just setting the header directly. Thoughts? |
With the pinning of 1.7.0 in the |
Pyramid JSON renderer returns
Content-Type: application/json; charset=utf-8
, but according to RFC 4627, theapplication/json
type doesn't have a charset parameter. It also describes why it's not needed.See http://stackoverflow.com/questions/13096259/can-charset-parameter-be-used-with-application-json-content-type-in-http-1-1
The text was updated successfully, but these errors were encountered: