Skip to content
Myr

refactored req.param()

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 ebcb1ca · Browse files · 1 file+6 added−13 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+6 added−13 removed

  • other:+6 added−13 removed

1 file+6 added−13 removed

modified:lib/request.js+6 added-13 removed
221 unmodified lines
222 * @api public223 */224225req.param = function(name, defaultValue){226 // route params227 if (this.params228 && this.params.hasOwnProperty(name)229 && undefined !== this.params[name]) {230 return this.params[name]; 231 }232233 // req.body234 if (this.body && undefined !== this.body[name]) return this.body[name];235236 // query-string237 if (undefined !== this.query[name]) return this.query[name]; 238226 var params = this.params || {};227 var body = this.body || {};228 var query = this.query || {};229 if (null != params[name]) return params[name];230 if (null != body[name]) return body[name];231 if (null != query[name]) return query[name];232 return defaultValue;233};234235/**
172 unmodified lines