Don't mangle the options object in res.cookie #1458

Merged
merged 1 commit into from Jan 3, 2013

Conversation

Projects
None yet
2 participants
Contributor

gmethvin commented Jan 3, 2013

Make a copy of the cookie options before mutating it to pass to
cookie.serialize. This prevents unexpected things from happening when
we try to use the same options object multiple times.

Also add a test to verify that the options object does not change
after a request is made.

This fixes #1449. I had been doing clones to work around this in my
own code, but I much prefer this solution.

Don't mangle the options object in res.cookie
Make a copy of the cookie options before mutating it to pass to
cookie.serialize. This prevents unexpected things from happening when
we try to use the same options object multiple times.

Also add a test to verify that the options object does not change
after a request is made.

tj added a commit that referenced this pull request Jan 3, 2013

Merge pull request #1458 from gmethvin/cookie_options
Don't mangle the options object in res.cookie

@tj tj merged commit d4e56c1 into expressjs:master Jan 3, 2013

1 check passed

default The Travis build passed
Details

@gmethvin gmethvin deleted the gmethvin:cookie_options branch Jan 5, 2013

rlidwka pushed a commit to rlidwka/express that referenced this pull request Aug 6, 2014

Merge pull request #1458 from gmethvin/cookie_options
Don't mangle the options object in res.cookie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment