Skip to content

Fix cookie header duplication - #522

Merged
andrew merged 3 commits into
splitrb:masterfrom
andrehjr:fix-cookie-header-duplication
May 17, 2018
Merged

Fix cookie header duplication#522
andrew merged 3 commits into
splitrb:masterfrom
andrehjr:fix-cookie-header-duplication

Conversation

@andrehjr

Copy link
Copy Markdown
Member

References #508 and fix a bug introduced by #490

Using ActionDispatch::Cookies from rails, manages flushing/replacing cookies on its own. Sinatra also have something like it on Sinatra::Cookies.

When using Rack directly you have to take care of that. Each time set_cookie was called it was adding another Set-Cookie entry to response.

This PR does:

  • Adds back compatibility to ActionDispatch::Cookies. Tries to use it when available
  • Fallbacks to parsing/replacing the Set-Cookie header on any Rack app - I still want to think of a more generic/best way to do this.
thoughtless and others added 3 commits April 28, 2018 14:14
Otherwise parse current cookies set on response and replace it using Rack directly.
New methods like Rack::Utils#make_delete_cookie_header were only added on 2.0.0
@andrew

andrew commented May 17, 2018

Copy link
Copy Markdown
Member

Looks good to me, thanks for tackling this 👍

@andrew
andrew merged commit 3523e1c into splitrb:master May 17, 2018
@andrehjr
andrehjr deleted the fix-cookie-header-duplication branch January 4, 2019 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants