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

[fix] pass along set-cookie headers during SSR #2362

Merged
merged 1 commit into from
Sep 8, 2021
Merged

Conversation

benmccann
Copy link
Member

@benmccann benmccann commented Sep 3, 2021

ref #1198

@changeset-bot
Copy link

changeset-bot bot commented Sep 3, 2021

🦋 Changeset detected

Latest commit: f0bf9b7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

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

@benwoodward
Copy link

Thanks Ben!

@@ -219,7 +224,11 @@ export async function load_node({
/** @type {import('types/helper').ResponseHeaders} */
const headers = {};
for (const [key, value] of response.headers) {
if (key !== 'etag' && key !== 'set-cookie') headers[key] = value;
if (key === 'set-cookie') {
set_cookie_headers = set_cookie_headers.concat(value);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cookie value may included multiple k/v entries with comma joined see https://datatracker.ietf.org/doc/html/rfc2616#section-4.2. We should convert them to array of string. Here is a implementation: https://github.com/nfriedly/set-cookie-parser/blob/9cb7f099b9328bc6ab7b7c1eab31d8cfb41b2e44/lib/set-cookie.js#L126

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

Successfully merging this pull request may close these issues.

None yet

3 participants