Skip to content
Myr

Refactored res.header()

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 80c3b98 · Browse files · 1 file+3 added−5 removed
This commit

State

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

Diff stats

1 file+3 added−5 removed

  • other:+3 added−5 removed

1 file+3 added−5 removed

modified:lib/response.js+3 added-5 removed
255 unmodified lines
256http.ServerResponse.prototype.header = function(name, val){257 if (val === undefined) {258 return this.headers[name];259 } else {260 if (this.headers[name] && ~multiple.indexOf(name)) {261 return this.headers[name] += '\r\n' + name + ': ' + val;262 } else {263 return this.headers[name] = val;264 }260 return ~multiple.indexOf(name)261 ? (this.headers[name] = this.headers[name] || []).push(val)262 : this.headers[name] = val;263 }264};265266/**
122 unmodified lines