var deferred = $q.defer();
$http({
url: reservationsEndPoint,
method: 'GET',
withCredentials: true,
headers:
{'X-CSRF-Token':'Fetch'},
timeout:5000,
}).then(function (response) {
// console.log(response.headers('x-csrf-token'));
// var xcsrfToken = response.headers('x-csrf-token');
// xcsrfToken = response.headers('x-csrf-token');
deferred.resolve(response);
}, function (error) {
deferred.reject(error.data.error.message.value);
});
return deferred.promise;
But when i try with cors enabled, preflight call options are made automaically by browser :
And when i try to fetch the token from the response, i get nothing because of the options!