ReactiveX / rxjs

A reactive programming library for JavaScript
https://rxjs.dev
Apache License 2.0
30.8k stars 3.01k forks source link

Ajax header request add always cookies #5690

Open Vincent-Alibert opened 4 years ago

Vincent-Alibert commented 4 years ago

Bug Report

Context: The Ajax observable automatically sends cookies in the request because it is the default behavior of browsers. Because it's a optional parameters. What I would like: Do not send cookies automatically How I try to do it:

ajax({
    url: `${apiBaseUrl}${url}`,
    headers: { Cookie : null },
    })

what I would have liked A option useHeaderCookie which by default is true and if it is set to false, cookies are not sent

Environment

benlesh commented 4 years ago

This has changed a bit in RxJS 7. Can you try that out? In particular, it will still add the x-requested-with header (which is customary for a a library), but in theory, you can override that with a header configuration of 'x-requested-with': undefined. Let me know if that works for you.

Vincent-Alibert commented 4 years ago

thx for response. I did not try the version 7 of RxJS but add 'x-requested-with': undefined doesn't removed the Cookie in the header of the request. I will try this when I upgrade the version in the app