Skip to content
Myr

Simplify res.cookie to call res.append

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

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent bb53b20 · Browse files · 2 files+2 added−11 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+2 added−11 removed

  • other:+2 added−11 removed

2 files+2 added−11 removed

modified:lib/response.js+1 added-11 removed
799 unmodified lines
800 if (opts.path == null) {801 opts.path = '/';802 }803804 var headerVal = cookie.serialize(name, String(val), opts);804 this.append('Set-Cookie', cookie.serialize(name, String(val), opts));805806 // supports multiple 'res.cookie' calls by getting previous value807 var prev = this.get('Set-Cookie');808 if (prev) {809 if (Array.isArray(prev)) {810 headerVal = prev.concat(headerVal);811 } else {812 headerVal = [prev, headerVal];813 }814 }815 this.set('Set-Cookie', headerVal);806 return this;807};808809/**
244 unmodified lines
modified:History.md+1 added
3 unmodified lines
4 * Fix `res.format` error when only `default` provided5 * Fix issue where `next('route')` in `app.param` would incorrectly skip values6 * Fix using `*` before params in routes7 * Fix using capture groups before params in routes8 * Simplify `res.cookie` to call `res.append`9 * Use `array-flatten` module for flattening arrays10 * deps: accepts@~1.2.911 - deps: mime-types@~2.1.112 - perf: avoid argument reassignment & argument slice
2947 unmodified lines