Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

headers array unsupported #80

Open
sparecycles opened this issue Sep 22, 2023 · 0 comments
Open

headers array unsupported #80

sparecycles opened this issue Sep 22, 2023 · 0 comments

Comments

@sparecycles
Copy link

sparecycles commented Sep 22, 2023

Observation

https://fetch.spec.whatwg.org/#typedefdef-headersinit lists two options for the headers field (passing the Headers object isn't actually in the spec).

In lib.dom.d.ts the field has the following type ( link )

type HeadersInit = [string, string][] | Record<string, string> | Headers;

image

This array format is unsupported by the current code (only Headers objects or the dictionary form are).

Impact

// this works as expected the first time only, when there's no cookies yet
await fetchCookie(url, { headers: [["x-my-header": "my-header-value"]] });

// this overwrites the headers with the cookie -- removing any headers passed here. ⚠️ 
await fetchCookie(url, { headers: [["x-my-header": "my-header-value"]] });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant