I\'m willing to retrieve the response header of a resource request, cause I\'ve put pagination information and something else in it rather than the response body, to make the RE
I had the exact same problem. I used an interceptor in the resource definition to inject the http headers in the resource.
$resource('/api/resource/:id', {
id: '@id'
}, {
index: {
method: 'GET',
isArray: true,
interceptor: {
response: function(response) {
response.resource.$httpHeaders = response.headers;
return response.resource;
}
}
}});
Then, in the then
callback, the http headers are accesible through $httpHeaders
:
promise.then(function(resource) {
resource.$httpHeaders('header-name');
});