Skip to content
Myr

Added: coerce `res.set()` values to strings

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

if you use res.get() this can bite you in the ass if you set an etag to a number for example :) good times

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parent a169cc7 · Browse files · 2 files+16 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+16 added−3 removed

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

2 files+16 added−3 removed

modified:lib/response.js+2 added-2 removed
394 unmodified lines
395396res.set = 397res.header = function(field, val){398 if (2 == arguments.length) {399 this.setHeader(field, val);399 this.setHeader(field, '' + val);400 } else {401 for (var key in field) {402 this.setHeader(key, field[key]);402 this.setHeader(key, '' + field[key]);403 }404 }405 return this;406};
235 unmodified lines
modified:test/res.set.js+14 added-1 removed