Skip to content
Myr

Deprecate req.param()

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

closes #2440

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent ec8daf0 · Browse files · 2 files+9 added−1 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+9 added−1 removed

  • other:+9 added−1 removed

2 files+9 added−1 removed

modified:lib/request.js+8 added-1 removed
198 unmodified lines
199 * @return {String}200 * @api public201 */202203req.param = function(name, defaultValue){203req.param = function param(name, defaultValue) {204 var params = this.params || {};205 var body = this.body || {};206 var query = this.query || {};207208 var args = arguments.length === 1209 ? 'name'210 : 'name, default';211 deprecate('req.param(' + args + '): Use req.params, req.body, or req.query instead');212213 if (null != params[name] && params.hasOwnProperty(name)) return params[name];214 if (null != body[name]) return body[name];215 if (null != query[name]) return query[name];216217 return defaultValue;218};219220/**
247 unmodified lines
modified:History.md+1 added
1unreleased2==========34 * Deprecate leading `:` in `name` for `app.param(name, fn)`5 * Deprecate `req.param()` -- use `req.params`, `req.body`, or `req.query` instead6 * Fix `OPTIONS` responses to include the `HEAD` method properly7 * Fix `res.sendFile` not always detecting aborted connection8 * Match routes iteratively to prevent stack overflows9
2549 unmodified lines