Skip to content
Myr

Added `res.get(field)` as an alternative to `res.header(field)`

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 19a1a22 · Browse files · 1 file+20 added−8 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+20 added−8 removed

  • other:+20 added−8 removed

1 file+20 added−8 removed

modified:lib/response.js+20 added-8 removed
252 unmodified lines
253 });254};255256/**257 * Set header field `name` to `val`.257 * Set header `field` to `val`.258 *259 * @param {String} name259 * @param {String} field260 * @param {String} val261 * @return {ServerResponse} for chaining262 * @api public263 */264265res.set = function(name, val){266 this.setHeader(name, val);265res.set = function(field, val){266 this.setHeader(field, val);267 return this;268};269270/**271 * Set or get response header `name` with optional `val`.271 * Get value for header `field`.272 *273 * @param {String} field274 * @return {String}275 * @api public276 */277278res.get = function(field){279 return this.getHeader(field);280};281282/**283 * Set or get response header `field` with optional `val`.284 *285 * @param {String} name286 * @param {String} val287 * @return {ServerResponse} for chaining288 * @api public289 */290279res.header = function(name, val){280 if (1 == arguments.length) return this.getHeader(name);281 this.setHeader(name, val);291res.header = function(field, val){292 if (1 == arguments.length) return this.getHeader(field);293 this.setHeader(field, val);294 return this;295};296297/**
140 unmodified lines