Franz657587
Franz657587

Reputation: 63

how can I get all header values for a request in firefox addon sdk?

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

Answers (1)

paa
paa

Reputation: 5054

httpChannel.visitRequestHeaders(function(header, value){
  // do something
});

Upvotes: 3

Related Questions