Skip to content
Myr

Added JSON cookie support & tests. Closes #879

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 e27b224 · Browse files · 3 files+64 added−2 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+64 added−2 removed

  • tests:+63 added−2 removed
  • other:+1 added−0 removed

3 files+64 added−2 removed

modified:lib/response.js+1 added
368 unmodified lines
369 */370371res.cookie = function(name, val, options){372 options = options || {};373 if ('object' == typeof val) val = 'j:' + JSON.stringify(val);374 if ('maxAge' in options) options.expires = new Date(Date.now() + options.maxAge);375 if (undefined === options.path) options.path = this.app.set('root');376 var cookie = utils.serializeCookie(name, val, options);377 this.header('Set-Cookie', cookie);
181 unmodified lines
added:test/req.cookies.js+43 added
modified:test/res.cookie.js+20 added-2 removed