Skip to content
Myr

Merge pull request #1477 from gmethvin/set_array

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

Allow setting an array of header values in the response

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parents 6b1d7a9, 4031aaa · Browse files · 2 files+24 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

2 files+24 added−3 removed

  • tests:+21 added−0 removed
  • other:+3 added−3 removed

2 files+24 added−3 removed

modified:lib/response.js+3 added-3 removed
508 unmodified lines
509 * @api public510 */511512res.set =513res.header = function(field, val){513res.header = function header(field, val){514 if (2 == arguments.length) {515 this.setHeader(field, '' + val);515 this.setHeader(field, Array.isArray(val) ? val.map(String) : String(val));516 } else {517 for (var key in field) {518 this.setHeader(key, '' + field[key]);518 header.call(this, key, field[key]);519 }520 }521 return this;522};
229 unmodified lines
modified:test/res.set.js+21 added