PDA

View Full Version : [FIXED][3.0rc2] Content-Type is hard coded when using xmlData



dolittle
22 Jun 2009, 9:36 AM
[Ext3.0RC2]I'm creating a Ext.data.Connection instance and sending xmlData
using a cross domain request(FF3.5, Safari4)
but the Content-Type is hard coded to be text/xml; charset=UTF-8
I think that the code is in line 1346 of ext-core-debug.js:

if(xmlData || jsonData){
initHeader('Content-Type', xmlData ? 'text/xml' : 'application/json');
data = xmlData || Ext.encode(jsonData);
}
It should set the Content-Type only if the user didn't set it already.
Like Brian explains here (http://extjs.com/forum/showthread.php?p=143906#post143906).

Mozilla docs (https://developer.mozilla.org/En/HTTP_access_control) says that for cross-domain requests:
1. The request Content-Type should be application/x-www-form-urlencoded, multipart/form-data, or text/plain.
2. The request shouldn't set custom Headers like X-Requested-With.

2. can be set using

Ext.lib.Ajax.useDefaultXhrHeader = false;
but 1. can't. I've tried to set the Content-Type to be text/html
by seting headers in the request or defaultHeaders in when creating
the conn object but as stated above it's hard coded.

evant
22 Jun 2009, 10:26 AM
Fixed in SVN.