When I run the $save function, which triggers my angularJS $resource to send a POST request to my API, everything seems to be working fine. I can successfully debug into the success callback handler and confirm that the object is created in my API.
myObj.$save({}, function (value, responseHeaders) {
myObj.someSuccessFunction();
}, function (responseText) {
myObj.someFailureFunction();
});
However, there is an issue with the "responseHeaders" parameter. When I try to access it using "responseHeaders()", it returns an empty object. Specifically, I need to retrieve the "Location" response header like this: responseHeaders("Location").
Interestingly, when I debug in Chrome, I can see that the Response is populated correctly. It's just the "responseHeaders" object that remains empty for some reason.
Does anyone have any suggestions on how to access these responseHeaders properly?
Thank you!