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

Send a given cookie name only once per fastboot response #195

Merged
merged 1 commit into from
Nov 9, 2018

Conversation

vincent99
Copy link
Contributor

Currently, every time something calls write() a new Set-Cookie header gets added for fastboot. So if you do:

cookies.write('foo', 'value1');
cookies.write('foo', 'value2');

The response headers are sent as:

Set-Cookie: foo=value1
Set-Cookie: foo=value2

And all that is sent in the response back to the client/browser, which then ignores all but the last set for a given key. ember-simple-auth in particular does several sets of the same key and ends up constantly sending multiple values for the same cookie.

This PR changes write() -> _writeFastBootCookie(name, value) to look for an existing set-cookie header for name and replace the existing entry's value with the new one if found, instead of always appending a new entry.

@vincent99 vincent99 changed the title Set a given cookie name only once per fastboot response Send a given cookie name only once per fastboot response Sep 24, 2018
@marcoow marcoow merged commit 3626abc into mainmatter:master Nov 9, 2018
@vincent99 vincent99 deleted the replace-headers branch February 14, 2019 20:07
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.

2 participants