Reputation: 63
I am trying to read headers using the firefox addon sdk using nsIHttpChannel
like..
var httpChannel = subject.QueryInterface(Ci.nsIHttpChannel);
console.log(httpChannel.getRequestHeader("Host"));
works but I would like to replicate the complete header and the getRequestHeader only allows asking for one specific line. Do you know of a way to loop true all of them?
I tried serialisazion but that only leads to ({}).
for (var key in httpChannel) {
if (httpChannel.hasOwnProperty(key)) {
console.log(key + " -> " + httpChannel[key]);
}
list only Attributes but not the headers
Upvotes: 2
Views: 799
Reputation: 5054
httpChannel.visitRequestHeaders(function(header, value){
// do something
});
Upvotes: 3