Skip to content
Myr

Remove res.json(obj, status) signature

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

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent e66625b · Browse files · 3 files+5 added−38 removed
This commit

State

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

Diff stats

3 files+5 added−38 removed

  • tests:+0 added−28 removed
  • other:+5 added−10 removed

3 files+5 added−38 removed

modified:lib/response.js+4 added-10 removed
200 unmodified lines
201202res.json = function json(obj) {203 var val = obj;204205 // allow status / body205 // support res.json(status, obj)206 if (arguments.length === 2) {207 // res.json(body, status) backwards compat208 if (typeof arguments[1] === 'number') {209 deprecate('res.json(obj, status): Use res.status(status).json(obj) instead');210 this.statusCode = arguments[1];211 } else {212 deprecate('res.json(status, obj): Use res.status(status).json(obj) instead');213 this.statusCode = arguments[0];214 val = arguments[1];207 deprecate('res.json(status, obj): Use res.status(status).json(obj) instead');208 this.statusCode = arguments[0];209 val = arguments[1];215 }210 }211212 // settings213 var app = this.app;
746 unmodified lines
modified:test/res.json.js-28 removed
modified:History.md+1 added
15.x2===34 * remove:5 - `res.json(obj, status)` signature - use `res.json(status, obj)`6 - `res.send(body, status)` signature - use `res.send(status, body)`7 * change:8 - `req.host` now returns host (`hostname:port`) - use `req.hostname` for only hostname9
2450 unmodified lines