Skip to content
Myr

Fix behavior of null/undefined as "maxAge" in res.cookie

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

fixes #3935 closes #3936

authored by Chris Barth · committed by Douglas Christopher Wilson · parent 1cc8169 · Browse files · 3 files+38 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+38 added−3 removed

  • tests:+30 added−0 removed
  • other:+8 added−3 removed

3 files+38 added−3 removed

modified:lib/response.js+7 added-3 removed
866 unmodified lines
867 if (signed) {868 val = 's:' + sign(val, secret);869 }870871 if ('maxAge' in opts) {872 opts.expires = new Date(Date.now() + opts.maxAge);873 opts.maxAge /= 1000;871 if (opts.maxAge != null) {872 var maxAge = opts.maxAge - 0873874 if (!isNaN(maxAge)) {875 opts.expires = new Date(Date.now() + maxAge)876 opts.maxAge = Math.floor(maxAge / 1000)877 }878 }879880 if (opts.path == null) {881 opts.path = '/';
288 unmodified lines
modified:test/res.cookie.js+30 added
modified:History.md+1 added
2 unmodified lines
34 * Add "root" option to `res.download`5 * Allow `options` without `filename` in `res.download`6 * Deprecate string and non-integer arguments to `res.status`7 * Fix behavior of `null`/`undefined` as `maxAge` in `res.cookie`8 * Ignore `Object.prototype` values in settings through `app.set`/`app.get`9 * Invoke `default` with same arguments as types in `res.format`10 * Support proper 205 responses using `res.send`11 * deps: depd@2.0.0
3542 unmodified lines