Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #18 from mtkopone/fix-express-cookie-duplication

Fix express cookie duplication
  • Loading branch information...
commit 19985edbe35db462da346429747eacc79b72be2e 2 parents 57226c0 + f8cbb1f
@jed jed authored
Showing with 3 additions and 2 deletions.
  1. +1 −2  lib/cookies.js
  2. +1 −0  test/express.js
  3. +1 −0  test/http.js
View
3  lib/cookies.js
@@ -38,10 +38,9 @@ Cookies.prototype = {
set: function(name, value, opts) {
var res = this.response
, req = this.request
- , headers = res.getHeader("Set-Cookie") || []
+ , headers = res.set ? [] : res.getHeader("Set-Cookie") || []
, secure = req.connection.encrypted
, cookie = new Cookie(name, value, opts)
- , header
, signed = opts && opts.signed !== undefined ? opts.signed : !!this.keys
if (typeof headers == "string") headers = [headers]
View
1  test/express.js
@@ -56,6 +56,7 @@ http.get( options, function( res ) {
console.log( "\ncookies set:", header )
console.log( "\n============\n" )
+ assert.equal(header.length, 6)
options.path = res.headers[ "Location" ]
options.headers = { "Cookie": header.join(";") }
View
1  test/http.js
@@ -55,6 +55,7 @@ http.get( options, function( res ) {
console.log( "\ncookies set:", cookies )
console.log( "\n============\n" )
+ assert.equal(cookies.length, 6)
options.path = res.headers[ "location" ]
options.headers = { "Cookie": cookies.join(";") }
Please sign in to comment.
Something went wrong with that request. Please try again.