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

Add support for getSetCookie() method #56

Closed
nfriedly opened this issue Feb 10, 2023 · 1 comment
Closed

Add support for getSetCookie() method #56

nfriedly opened this issue Feb 10, 2023 · 1 comment

Comments

@nfriedly
Copy link
Owner

nfriedly commented Feb 10, 2023

Now that whatwg/fetch#1346 is landed, the fetch() spec has a new response.headers.getSetCookie() method for getting individual (non-combined) set-cookie headers.

We should detect the presence of getSetCookie() and call it when available.

Additionally the documentation should be cleaned up to clarify that splitCookiesString() is only necessary when working with older implementations.

@nfriedly nfriedly changed the title Document usage with new fetc() spec Add support for getSetCookie() method Feb 10, 2023
@nfriedly
Copy link
Owner Author

Note: to anyone who's interested, I believe you can already use this method manually, e.g. something like this:

const response = await fetch(/*...*/);

const cookies = setCookie.parse(response.headers.getSetCookie());

console.log(cookies); // should be an array of cookies

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