I have made an http interceptor in which I need to evaluate responese headers and find particular one (authorization). Interceptor itself is working however it is unable to list headers which I am setting on server side and which I can clearly see set in firebug's network tab.
interceptor:
app.factory('HttpItc', function($q, $localStorage, $injector) {
return {
response: function (response) {
//console.log(response); // Contains the data from the response.
var freshJwt = response.headers['Authorization'];
if (freshJwt) {
$localStorage.jwt = freshJwt;
}
// Return the response or promise.
return response;
} };});
This is how I set headers in Express on the server side:
return res
.header('Authorization', jwt)
.header('testHeader', 'testValue')
.json(user);
What is happening? How can I get access to response headers in http's interceptor?


var jwt = response.headers('Authorization')