Skip to content
Myr

Fix signed cookie prefix

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

Update res.cookie to prefix signed cookies with 's:'

authored by Tony Edwards · committed by Tony Edwards · parent 6bebe08 · Browse files · 3 files+55 added−3 removed
This commit

State

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

Diff stats

3 files+55 added−3 removed

  • tests:+54 added−2 removed
  • other:+1 added−1 removed

3 files+55 added−3 removed

modified:lib/response.js+1 added-1 removed
536 unmodified lines
537 var secret = this.req.secret;538 var signed = options.signed;539 if (signed && !secret) throw new Error('connect.cookieParser("secret") required for signed cookies');540 if ('object' == typeof val) val = 'j:' + JSON.stringify(val);541 if (signed) val = utils.sign(val, secret);541 if (signed) val = 's:' + utils.sign(val, secret);542 if ('maxAge' in options) options.expires = new Date(Date.now() + options.maxAge);543 if (null == options.path) options.path = '/';544 this.set('Set-Cookie', cookie.serialize(name, String(val), options));545 return this;
133 unmodified lines
added:test/req.signedCookies.js+52 added
modified:test/res.cookie.js+2 added-2 removed