Despite Chrome showing the correct POST response headers, my custom HTTP header X-Auth-Token
is returning null in the callback function for the POST request. Angular.js seems to only be returning Cache-Control and Content-Type, with everything else showing up as null.
Here's a snippet of my CoffeeScript code where I make the call:
.factory 'loginFactory', ($rootScope, $http, $resource) ->
$resource '/api/auth/login',
email: '@id'
password: '@id'
.controller 'userController', ($scope, $state, $http, loginFactory, userService) ->
$scope.validationError = false
$scope.user =
email: ''
password: ''
$scope.loginUser = ->
loginFactory.save $scope.user, (u, headers) ->
console.log headers('X-Auth-Token')
.$promise.then (response) ->
unless response.error
userService.login($scope.user.email, $scope.user.password)
unless userService.redirIfLoggedIn()
$scope.validationError = true
I've also attempted running earlier versions of Angular like 1.3.x, but encountered the same issue.
Why does Angular only return those specific two headers when making a request?