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

responseHeaders['set-cookie'] better stores in an array? #1616

Closed
OKFred opened this issue Aug 24, 2022 · 3 comments
Closed

responseHeaders['set-cookie'] better stores in an array? #1616

OKFred opened this issue Aug 24, 2022 · 3 comments

Comments

@OKFred
Copy link

OKFred commented Aug 24, 2022

headers.append(key, val)

When it comes to response headers: 'set-cookie', the value stores as a string as well.
The problem is that there may be multiple 'set-cookie' headers in various of formats sent from the server.
Hard to split when joined in a string. (Or, do you have any better ideas defining the splitter? Coz I am a newbie)

It would be easier to handle as an array.
Reasons/References are as follows:

Thx & B/R
Fred

@ronag
Copy link
Member

ronag commented Aug 24, 2022

This is how the fetch spec defines the behavior and is not something I believe we can change.

@mcollina
Copy link
Member

See wintercg/fetch#7.
As soon as a spec-compatible API is available, we'll implement it.

@OKFred
Copy link
Author

OKFred commented Aug 24, 2022

@ronag Are you referring to the Fetch Standard? https://fetch.spec.whatwg.org/#headers-class
The following quotes could be quite informative:
Unlike a header list, a Headers object cannot represent more than one Set-Cookie header. In a way this is problematic as unlike all other headers Set-Cookie headers cannot be combined, but since Set-Cookie headers are not exposed to client-side JavaScript this is deemed an acceptable compromise. Implementations could choose the more efficient Headers object representation even for a header list, as long as they also support an associated data structure for Set-Cookie headers.

Anyway, glad to hear if we can move on one day. @mcollina

Thx & B/R
Fred

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

3 participants