Skip to content
Myr

Remove res.jsonp(status, obj) signature

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

closes #2940

authored by Mike Tunnicliffe · committed by Douglas Christopher Wilson · parent 25fdefa · 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
228 unmodified lines
229 * @public230 */231232res.jsonp = function jsonp(obj) {233 var val = obj;234235 // support res.jsonp(status, obj)236 if (arguments.length === 2) {237 deprecate('res.jsonp(status, obj): Use res.status(status).jsonp(obj) instead');238 this.statusCode = arguments[0];239 val = arguments[1];240 }241233 // settings234 var app = this.app;235 var replacer = app.get('json replacer');236 var spaces = app.get('json spaces');246 var body = stringify(val, replacer, spaces);237 var body = stringify(obj, replacer, spaces);238 var callback = this.req.query[app.get('jsonp callback name')];239240 // content-type241 if (!this.get('Content-Type')) {
698 unmodified lines
modified:test/res.jsonp.js-15 removed
284 unmodified lines
285 })286 })287 })288289 describe('.jsonp(status, object)', function(){290 it('should respond with json and set the .statusCode', function(done){291 var app = express();292293 app.use(function(req, res){294 res.jsonp(201, { id: 1 });295 });296297 request(app)298 .get('/')299 .expect('Content-Type', 'application/json; charset=utf-8')300 .expect(201, '{"id":1}', done)301 })302 })303289 it('should not override previous Content-Types', function(done){290 var app = express();291292 app.get('/', function(req, res){
10 unmodified lines
modified:History.md+1 added
3 unmodified lines
4This 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.jsonp(status, obj)` signature - use `res.status(status).jsonp(obj)`9 - `res.vary()` (no arguments) -- provide a field name as an argument10115.0.0-alpha.2 / 2015-07-0612==========================
3177 unmodified lines