Skip to content
Myr

when cookie path === null dont default it

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 6815feb · Browse files · 2 files+20 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+20 added−1 removed

  • tests:+19 added−0 removed
  • other:+1 added−1 removed

2 files+20 added−1 removed

modified:lib/response.js+1 added-1 removed
320 unmodified lines
321322res.cookie = function(name, val, options){323 options = options || {};324 if ('maxAge' in options) options.expires = new Date(Date.now() + options.maxAge);325 options.path = options.path || this.app.set('home');325 if (undefined === options.path) options.path = this.app.set('home');326 var cookie = utils.serializeCookie(name, val, options);327 this.header('Set-Cookie', cookie);328};329
132 unmodified lines
modified:test/response.test.js+19 added
648 unmodified lines
649 .should.eql(['rememberme=yes; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT; httpOnly', 'something=else; path=/']);650 });651 },652653 'test #cookie() null path': function(){654 var app = express.createServer();655656 app.set('/home', '/foo');657658 app.get('/', function(req, res){659 res.cookie('rememberme', 'yes', { path: null, expires: new Date(1), httpOnly: true });660 res.cookie('something', 'else', { path: null });661 res.redirect('/');662 });663664 assert.response(app,665 { url: '/', headers: { Host: 'foo.com' }},666 function(res){667 res.headers['set-cookie']668 .should.eql(['rememberme=yes; expires=Thu, 01 Jan 1970 00:00:00 GMT; httpOnly', 'something=else']);669 });670 },671672 'test #clearCookie() default path': function(){673 var app = express.createServer();674675 app.set('home', '/foo');
57 unmodified lines