Skip to content

Fix setting multiple cookie headers in the response#36

Closed
sandydoo wants to merge 4 commits intoember-fastboot:masterfrom
sandydoo:bugfix-cookies
Closed

Fix setting multiple cookie headers in the response#36
sandydoo wants to merge 4 commits intoember-fastboot:masterfrom
sandydoo:bugfix-cookies

Conversation

@sandydoo
Copy link
Copy Markdown

@sandydoo sandydoo commented Dec 18, 2017

Patches #33 and mainmatter/ember-cookies#133.

Cookies were previously set together with the other headers. This meant that if you were to set more than one cookie in FastBoot, each subsequent cookie would overwrite the Set-Cookie header and only the last cookie would be sent in the response. This particularly affects ember-simple-auth.

This commit extracts the cookie headers, dedups them by name and sets the header at once to set multiple cookies.

This doesn't use res.cookie because we're already dealing with serialized headers.
Should be compliant down to node 4.

Todo:

  • Set cookies in the test app to make the tests pass. How do we do this?

Cookies were previously set together with the other headers. This meant that if
you were to set more than one cookie in FastBoot, each subsequent cookie would
overwrite the `Set-Cookie` header and only the last cookie would be sent in the
response. This commit extracts the cookie headers, dedups them by name and sets
the header at once to set multiple cookies.
@sandydoo sandydoo changed the title Allow setting multiple cookie headers in the response Fix setting multiple cookie headers in the response Jan 14, 2018
@morgano86
Copy link
Copy Markdown

Any update on this?

@stephankaag
Copy link
Copy Markdown

Ping @rwjblue :-)

@simonihmig
Copy link
Copy Markdown

Also waiting for this...

@rwjblue rwjblue requested review from kratiahuja and tomdale January 25, 2019 18:12
Copy link
Copy Markdown
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

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

Made some suggested changes inline, definitely 👍 on getting this fixed...

Comment thread src/index.js Outdated
Comment thread src/index.js Outdated
Comment thread src/index.js Outdated
Comment thread src/index.js Outdated
Comment thread src/index.js Outdated
rwjblue and others added 2 commits January 25, 2019 22:22
- Use `Map` to store cookies.
- Set cookie header only when cookies are present.

Co-Authored-By: sandydoo <sandydoo@users.noreply.github.com>
@sandydoo
Copy link
Copy Markdown
Author

Made some suggested changes inline, definitely 👍 on getting this fixed...

🔥 Great stuff! Any thoughts on how we can get a working test for this?

@sandydoo
Copy link
Copy Markdown
Author

Closing since #60 has been merged. Thanks, @bobisjan and @rwjblue!

@sandydoo sandydoo closed this Nov 28, 2020
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.

5 participants