0

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 enter image description here

5
  • 1
    Can you please add the desired behaviour? Right now it's a bit unclear what your question is. Commented Sep 27, 2018 at 17:33
  • Inside the cookie, where it says language = us-US , I want it to say pt-PT since that is what I have on my code Commented Sep 27, 2018 at 17:36
  • 1
    Great :) Edit your question and add that that's the result you're looking for. Not everyone looks through the comments. Commented Sep 27, 2018 at 17:37
  • 1
    stackoverflow.com/questions/30216155/… Commented Sep 27, 2018 at 17:51
  • @JameeIM thanks but I am not asking about the accept language , but the cookie itself carrying a variable called language and then it's value Commented Sep 28, 2018 at 10:31

1 Answer 1

1

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'}).

Sign up to request clarification or add additional context in comments.

1 Comment

This helped the cookie to disappear from outside the cookie field, it no longer appears as a header tho this doesn't seem to change the language for me and I don't think the domain is wrong, thanks , I will keep looking

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.