Closed geoffsalmon closed 13 years ago
Using gallery-jsonrpc, Chromium is sending a strange Content-Type header. Here's the code I'm using to send the request:
YUI({ gallery: 'gallery-2010.10.27-19-38' }).use('gallery-jsonrpc', function(Y){ var api = new Y.JSONRPC({ url: '/cmd', preload: false}); api.exec('testjson', [], function(result) {}); });
and here's the headers from the resulting HTTP requests for the browsers I have available:
Chromium 9.0.597.84 (72991) Content-Type: application/x-www-form-urlencoded; charset=UTF-8 application/json
Firefox 2.6.13 Content-Type: application/json; charset=UTF-8
Opera 11.01 (1190) Content-Type: application/json
It's weird that Chromium appends the "application/json" on the end like that. If I add an event handler on dispatch to change the Content-Type key to be "Content-Type" like this
api.on('dispatch', function(e){ var headers = e.ioConfig.headers; delete headers['content-type']; headers['Content-Type'] = 'application/json'; });
then the request from Chromium has the header: Content-Type: application/json
I don't know if this is a bug in Chromium or not, and what versions of Chrome it might affect, but I think changing the lines in Y.JSONRPC.exec from
headers: { 'content-type': 'application/json' },
to
headers: { 'Content-Type': 'application/json' },
will fix it.
Yes indeed. I've updated to Content-Type: application/json; charset=utf-8
Issuing a Gallery pull request in 3....2....1...
Using gallery-jsonrpc, Chromium is sending a strange Content-Type header. Here's the code I'm using to send the request:
and here's the headers from the resulting HTTP requests for the browsers I have available:
Chromium 9.0.597.84 (72991) Content-Type: application/x-www-form-urlencoded; charset=UTF-8 application/json
Firefox 2.6.13 Content-Type: application/json; charset=UTF-8
Opera 11.01 (1190) Content-Type: application/json
It's weird that Chromium appends the "application/json" on the end like that. If I add an event handler on dispatch to change the Content-Type key to be "Content-Type" like this
then the request from Chromium has the header: Content-Type: application/json
I don't know if this is a bug in Chromium or not, and what versions of Chrome it might affect, but I think changing the lines in Y.JSONRPC.exec from
to
will fix it.