-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Allow setting multiple cookies in Netlify adapter #3092
Conversation
🦋 Changeset detectedLatest commit: 15cd9fc The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a doc comment
body: responseBody, | ||
}; | ||
|
||
// Special-case set-cookie which has to be set an different way :/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so strange. mind expanding a bit on why exactly this is needed, for future readers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sure, the tldr here is that the Fetch API concatenates headers and comma-separates them when you try to get them with headers.get('foo')
. Set-Cookie is the only header that doesn't work comma-separated and must be set with multiple Set-Cookie
headers. Fetch does not have an API for that, because there's no need for it in the browser.
Luckily node-fetch has a special API for this use-case and Netlify will always use that polyfill so its safe to use. Other adapters will have to do it different ways, since there is no standard.
For reference (with various host providers weighing in): whatwg/fetch#973
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add a comment with a link to that issue.
perfect, thanks! LGTM to merge |
Changes
Testing
Test added
Docs
N/A, bug fix