Getting a cookie from $http.post request


#1

For some reasons I cannot fetch that cookie from the response that I get after http.post request:

$http({
...
}).
.success(function(data, status, header) {

console.log(header('Set-Cookie')); // returns null
console.log(header('cookie')); // returns null
console.log($cookies) // returns an empty object

});

However it all perfectly works on a device, but not in my browser. I tried to run Chrome with open -a Google\ Chrome --args --disable-web-security but it also didn’t help…


#2

You probably need bracket notation to access the property on the response object:

console.log(header['Cookie'])

#3

Running in to this issue as well. I attempted using @adrichman’s suggestion but header[‘Cookie’] returns undefined as well.