I am building a simple angular 1.4.8 app that talks to a RESTful API. A user can add an item which POSTs to the REST API using $http. The API can respond with 201 created, or in case a similar item already exists with 409 status and a Location header indicating the existing item's ID.
In my app, to handle the case where an item exists I use the catch handler of the httpPromise, but I can't access the Location header there. In chrome dev tools, I see the POST request and 409 response with the Location header (Just to prove that it is there). While debugging, in the catch handler I inspect the function's argument and see the status 409, and a headers function, but the only header present is content-type, the Location header is missing.
How can I access the Location header from the httpPromise's response argument?
EDIT: Here you can see the request\response in the Network tab with the Location header:
Here you can see the piece of code that should look at the header and in the console the fact that the Location header is missing: