Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Cannot specify a custom "Cookie" header in Fetch API #169

Open
p0358 opened this issue Aug 19, 2021 · 1 comment
Open

Cannot specify a custom "Cookie" header in Fetch API #169

p0358 opened this issue Aug 19, 2021 · 1 comment

Comments

@p0358
Copy link

p0358 commented Aug 19, 2021

Describe the bug
No matter what kind of way I attempt to do so, I cannot include a custom Cookie header in a Fetch request. It seems that cookies are handled by the SDK automatically, and thus previously set cookies are automatically sent in the following requests. It appears that this behavior cannot be changed.
I also tried various values of the "credentials" ("include", "omit") and they didn't change anything about this bug.

To Reproduce
Steps to reproduce the behavior (scenario 1):

  1. Do fetch("https://example.com/api/user", { headers: { 'Cookie': 'SessionToken=' + this.token } })
  2. Server responds with "not logged in" error, because the value of cookie wasn't set

Steps to reproduce the behavior (scenario 2):

  1. Make a request to a server that sets a cookie with "Set-Cookie" header
  2. Make another request to the same server
  3. The value of "Cookie" header is now being sent, without any way to disable/get rid of that

Expected behavior

  1. Can specify a custom value of "Cookie" header, taking a precedence over whatever the header would normally be set to
  2. Have an option to not handle cookies automatically at all

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS] Windows 10
  • Browser [e.g. chrome, safari] sciter quark
  • Version [e.g. 22] latest commit (0f2022f), but problem happened for long time

Additional context
I cannot add a nice login session persistence to my app because of this. I want to handle login manually and just specify the cookie with "Cookie" header for API requests then.

@trialman
Copy link

same problem!!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants