Skip to content
Myr

Remove res.json(status, obj) signature

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

closes #2939

authored by Mike Tunnicliffe · committed by Douglas Christopher Wilson · parent a856456 · Browse files · 3 files+2 added−25 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+2 added−25 removed

  • tests:+0 added−15 removed
  • other:+2 added−10 removed

3 files+2 added−25 removed

modified:lib/response.js+1 added-10 removed
201 unmodified lines
202 * @public203 */204205res.json = function json(obj) {206 var val = obj;207208 // support res.json(status, obj)209 if (arguments.length === 2) {210 deprecate('res.json(status, obj): Use res.status(status).json(obj) instead');211 this.statusCode = arguments[0];212 val = arguments[1];213 }214206 // settings207 var app = this.app;208 var replacer = app.get('json replacer');209 var spaces = app.get('json spaces');219 var body = stringify(val, replacer, spaces);210 var body = stringify(obj, replacer, spaces);211212 // content-type213 if (!this.get('Content-Type')) {214 this.set('Content-Type', 'application/json');
734 unmodified lines
modified:test/res.json.js-15 removed
modified:History.md+1 added
2 unmodified lines
34This incorporates all changes after 4.13.1 up to 4.14.0.56 * remove:7 - `res.json(status, obj)` signature - use `res.status(status).json(obj)`8 - `res.vary()` (no arguments) -- provide a field name as an argument9105.0.0-alpha.2 / 2015-07-0611==========================
3177 unmodified lines