Skip to content
Myr

Added support for `res.set(obj)`. Closes #834

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 e301d43 · Browse files · 1 file+15 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

1 file+15 added−3 removed

  • other:+15 added−3 removed

1 file+15 added−3 removed

modified:lib/response.js+15 added-3 removed
271 unmodified lines
272 return this;273};274275/**276 * Set header `field` to `val`.276 * Set header `field` to `val`, or pass277 * an object of of header fields.278 *279 * Examples:280 *281 * res.set('Accept', 'application/json');282 * res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' });283 *278 * @param {String} field284 * @param {String|Object} field285 * @param {String} val286 * @return {ServerResponse} for chaining287 * @api public288 */289290res.set = function(field, val){291 if (2 == arguments.length) {285 this.setHeader(field, val);292 this.setHeader(field, val);293 } else {294 for (var key in field) {295 this.setHeader(key, field[key]);296 }297 }298 return this;299};300301/**
179 unmodified lines