Reputation: 885
This should be a simple one, but I'm having no luck.
I'm trying to log the authorization headers from a HTTP call.
console.log(headers);
gives me this map:
Map(9) {"date" => Array(1), "server" => Array(1), "authorization" => Array(1), "transfer-encoding" => Array(1), "content-type" => Array(1), …}
How do I get to the "authorization" header? I have tried:
console.log(headers.authorization);
console.log(headers[3]);
both of which return undefined
Upvotes: 0
Views: 48
Reputation: 237915
Map
objects are not accessed in the same way that standard Javascript {}
objects are. You need to use the get
and set
methods:
console.log(headers.get('authorization'));
Upvotes: 6