Permalink
Browse files

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

Fix express cookie duplication
  • Loading branch information...
jed committed Nov 12, 2012
2 parents 57226c0 + f8cbb1f commit 19985edbe35db462da346429747eacc79b72be2e
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
@@ -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
@@ -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
@@ -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(";") }

0 comments on commit 19985ed

Please sign in to comment.