Skip to content

Commit 2f2c636

Browse files
committed
Remove res.jsonp(status, obj) signature
1 parent 1dbfee6 commit 2f2c636

File tree

3 files changed

+5
-26
lines changed

3 files changed

+5
-26
lines changed

History.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
This incorporates all changes after 4.13.1 up to 4.14.0.
55

6+
* remove:
7+
- `res.jsonp(status, obj)` signature - use `res.status(status).jsonp(val)`
8+
69
5.0.0-alpha.2 / 2015-07-06
710
==========================
811

lib/response.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -234,20 +234,11 @@ res.json = function json(obj) {
234234
* res.jsonp(null);
235235
* res.jsonp({ user: 'tj' });
236236
*
237-
* @param {string|number|boolean|object} obj
237+
* @param {string|number|boolean|object} val
238238
* @public
239239
*/
240240

241-
res.jsonp = function jsonp(obj) {
242-
var val = obj;
243-
244-
// support res.jsonp(status, obj)
245-
if (arguments.length === 2) {
246-
deprecate('res.jsonp(status, obj): Use res.status(status).jsonp(obj) instead');
247-
this.statusCode = arguments[0];
248-
val = arguments[1];
249-
}
250-
241+
res.jsonp = function jsonp(val) {
251242
// settings
252243
var app = this.app;
253244
var replacer = app.get('json replacer');

test/res.jsonp.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -286,21 +286,6 @@ describe('res', function(){
286286
})
287287
})
288288

289-
describe('.jsonp(status, object)', function(){
290-
it('should respond with json and set the .statusCode', function(done){
291-
var app = express();
292-
293-
app.use(function(req, res){
294-
res.jsonp(201, { id: 1 });
295-
});
296-
297-
request(app)
298-
.get('/')
299-
.expect('Content-Type', 'application/json; charset=utf-8')
300-
.expect(201, '{"id":1}', done)
301-
})
302-
})
303-
304289
it('should not override previous Content-Types', function(done){
305290
var app = express();
306291

0 commit comments

Comments
 (0)