sciter-js-sdk icon indicating copy to clipboard operation
sciter-js-sdk copied to clipboard

Cannot specify a custom "Cookie" header in Fetch API

Open p0358 opened this issue 4 years ago • 1 comments

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.

p0358 avatar Aug 19 '21 18:08 p0358

same problem!!

trialman avatar Oct 11 '21 19:10 trialman