I am playing a bit with angular and i came across a little problem.
I am trying to set a custom header for http response and later read its value on angular's side. The header is set and I am sure of that because chrome's debug tool confirms that:
That means server side is fine. So far so good.
The problems occurs when I try to access headers via http response interceptor in angular and display them in console. Here's the code in coffeescript:
angular.module('app').factory 'httpInterceptor', function($q) ->
(promise) ->
success = (response) ->
console.log response.headers()
response
error = (response) ->
$q.reject(response)
promise.then success, error
angular.module('app').config ($httpProvider) ->
$httpProvider.responseInterceptors.push('httpInterceptor')
And i get the output:
I really don't understand why does angular strip all those headers. Could anyone explain it to me? Is there any way to access my custom header's value?
Thank you in advance.