Reputation: 1011
I have the following http get , that I would like to send a cookie with a language on the request, but turns out with $cookieStore, it sends the cookie outside of the request
$cookieStore.put("language", "pt-PT");
I tried this as well
var myObject = {
headers: { 'language': 'pt-PT'}
}//ignored
return $http.get(comm.endpoints.getEntityFinancialPosition, myObject );
In my debug I can see that this just created a new header that is not sent inside the cookie
Upvotes: 0
Views: 101
Reputation: 26
The scope of the cookie is restricted with the domain option. If page domain is different than API domain cookie will not be sent when making a request. To fix that set the right domain for the cookie $cookieStore.put("language", "pt-PT", {domain: 'requestdomain.com'})
.
Upvotes: 1