node-XMLHttpRequest icon indicating copy to clipboard operation
node-XMLHttpRequest copied to clipboard

Sync requests via jQuery fail

Open kevindente opened this issue 12 years ago • 2 comments

I tried making a sync request via jQuery through node-XMLHttpRequest. It threw a not-all-that-obvious error. I traced through the code, and found it was due to jQuery calling xhr.getAllResponseHeaders(). It appears that for the sync case node-xhr doesn't support getAllResponseHeaders. Specifically the current impl goes to the response object to get the headers, but the response object is defined because in the sync case there isn't one.

kevindente avatar Mar 23 '12 19:03 kevindente

Thanks. You're right, looks like sync requests don't set the response headers. I will work on this for the next release.

driverdan avatar Jun 01 '12 21:06 driverdan

I've just issued a PR that provides a work-around for this, and also for the "getAllResponseHeaders" part of #47 (Cannot read property 'headers' of undefined in XMLHttpRequest.js).

jjbenson avatar Feb 23 '15 15:02 jjbenson