PDA

View Full Version : [FIXED] useDefaultXhrHeader on a proxy has no effect



mankz
5 Jun 2014, 8:18 AM
Defining a proxy like this still results in the useDefaultXhrHeader of Ext.Ajax being used (true).


proxy : {
type : 'ajax',
useDefaultXhrHeader : false,
reader : {
type : 'json',
rootProperty : 'schedule.day.broadcasts'
},
disableCaching : false
}

mitchellsimoens
6 Jun 2014, 4:19 AM
Looks like setupHeaders in Ext.data.Connection not checking the options object but just gets the config to set the header:


if (me.getUseDefaultXhrHeader() && !headers['X-Requested-With']) {
headers['X-Requested-With'] = me.getDefaultXhrHeader();
}

rmichelli
5 Aug 2014, 5:44 AM
For anyone who doesn't have access to 5.0.1 yet, here's an override for setupHeaders in Ext.data.Connection to fix this ->

Replace:

if (me.getUseDefaultXhrHeader() && !headers['X-Requested-With']) {
headers['X-Requested-With'] = me.getDefaultXhrHeader();
}
With:

if (me.getUseDefaultXhrHeader() && options.useDefaultXhrHeader !== false && !headers['X-Requested-With']) {
headers['X-Requested-With'] = me.getDefaultXhrHeader();
}