Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
JSON renderer uses invalid Content-Type #1611
I guess I don't see what the issue is. The JSON RFC defines the content as UTF-8 by default but that other encodings are also valid. We are just being cautious, and according to your link still compliant, no?
It's not a major issue, but it's not compliant no. Any compliant parser will ignore the value because the
The only valid encodings for JSON is UTF8, UTF16, and UTF32. The way a compliant JSON parser determines encoding is by looking at the first four octects:
FWIW I'm OK if this is wontfixed too, I just noticed that it was generating a meaningless (to a compliant parser) value and figured I'd open an issue incase y'all cared.
Someone disagrees with you. The relevant code is in webob (where this issue belongs). Webob is explicitly adding a charset to application/json. A simple fix if webob stays the same is to delete the charset after setting the content type.
resp = Response(content_type='application/json') del resp.charset resp = Response() resp.content_type = 'application/json' del resp.charset resp = Response() resp.headers['Content-Type'] = 'application/json' # it looks like you can trick webob since it doesn't monitor headers for changes.