Closed GoogleCodeExporter closed 9 years ago
You can't set request header for open request (GET), because XDomainRequest and
Iframe don't allow it.
Donghwan
Original comment by flowersi...@gmail.com
on 31 Jul 2011 at 10:47
I know this isn't recommended because IE (iframe) / XDR don't support it.
But if you know you'll be using only a modern browser with xmlhttprequest you
can hack in the following to set request headers (line 507, right after
xhr.open()):
return {
open: function() {
xhr.open("GET", prepareURL(stream.url, stream.options.openData));
try {
for (var h in stream.options.headers ) {
xhr.setRequestHeader( h, stream.options.headers[ h ] );
}
} catch( _ ) {}
xhr.send();
},
Then when you create your request, you can use:
$.stream(url, {
headers: {
"X-My-Header" : "1",
"X-My-Other-HEader" : "2"
},
handleOpen: function(text, message, stream) {
},
handleMessage: function(text, message) {}
etc.etc...
Original comment by deganii
on 7 Feb 2012 at 8:06
Original issue reported on code.google.com by
smaucourt
on 30 Jul 2011 at 8:07