PDA

View Full Version : [FIXED][3.??] No headers sent by Ajax.request



excelsis
28 Jul 2009, 10:40 AM
HTTP headers get sent only once and never again.
Applies to Ext.Ajax.defaultHeaders and headers passed as part of request object.

To test:


Ext.Ajax.defaultHeaders = {'myheader':'test'};
Ext.Ajax.request({
url: './mBOSLib/Server/testHdr.aspx'
});
Ext.Ajax.request({
url: './mBOSLib/Server/testHdr.aspx'
});

Ext.Ajax.request({
url: './mBOSLib/Server/testHdr.aspx'
});

In Firebug the header "myheader" appears only on the first request.
The backend procedure is coded to provide a different response based on the presence of the header and this verifies that what I see in Firebug is correct.
I've tried adding headers in the request object with same result - header appears on first call and never again:


Ext.Ajax.request({
headers: {'otherhdr': 'true' },
url: './mBOSLib/Server/testHdr.aspx'
});

To test I've added params to switch method from GET to POST - same result.

IF I SWITCH THE EXACT SAME CODE TO EXT 2.2.1 IT WORKS FINE


I'm halfway through migrating all my apps and this is critical to the functioning of one of them.
Please please review ASAP.

excelsis
28 Jul 2009, 11:24 AM
Work around.
After every request (probably in beforerequest event) add the following:

delete Ext.lib.Ajax.headers;

The base adapter code sets headers to null but then uses applyIf.
Since the headers property will still be there (but null) the applyIf fails to assign any future headers.
The formal fix shoud use delete pb.headers instead of pb.headers = null.

Frankly I think I deserve some kind of brownie points for figuring this one out...

evant
28 Jul 2009, 10:45 PM
Fixed in SVN. Thanks for the report/debugging.