File tree 3 files changed +6
-25
lines changed
3 files changed +6
-25
lines changed Original file line number Diff line number Diff line change 1
1
5.x
2
2
===
3
3
4
+ * remove:
5
+ - ` res.send(body, status) ` signature - use ` res.send(status, body) `
4
6
* change:
5
7
- ` req.host ` now returns host (` hostname:port ` ) - use ` req.hostname ` for only hostname
6
8
Original file line number Diff line number Diff line change @@ -89,17 +89,11 @@ res.send = function send(body) {
89
89
// settings
90
90
var app = this . app ;
91
91
92
- // allow status / body
92
+ // support res.send( status, body)
93
93
if ( arguments . length === 2 ) {
94
- // res.send(body, status) backwards compat
95
- if ( typeof arguments [ 0 ] !== 'number' && typeof arguments [ 1 ] === 'number' ) {
96
- deprecate ( 'res.send(body, status): Use res.status(status).send(body) instead' ) ;
97
- this . statusCode = arguments [ 1 ] ;
98
- } else {
99
- deprecate ( 'res.send(status, body): Use res.status(status).send(body) instead' ) ;
100
- this . statusCode = arguments [ 0 ] ;
101
- chunk = arguments [ 1 ] ;
102
- }
94
+ deprecate ( 'res.send(status, body): Use res.status(status).send(body) instead' ) ;
95
+ this . statusCode = arguments [ 0 ] ;
96
+ chunk = arguments [ 1 ] ;
103
97
}
104
98
105
99
// disambiguate res.send(status) and res.send(status, num)
Original file line number Diff line number Diff line change @@ -66,21 +66,6 @@ describe('res', function(){
66
66
} )
67
67
} )
68
68
69
- describe ( '.send(body, code)' , function ( ) {
70
- it ( 'should be supported for backwards compat' , function ( done ) {
71
- var app = express ( ) ;
72
-
73
- app . use ( function ( req , res ) {
74
- res . send ( 'Bad!' , 400 ) ;
75
- } ) ;
76
-
77
- request ( app )
78
- . get ( '/' )
79
- . expect ( 'Bad!' )
80
- . expect ( 400 , done ) ;
81
- } )
82
- } )
83
-
84
69
describe ( '.send(code, number)' , function ( ) {
85
70
it ( 'should send number as json' , function ( done ) {
86
71
var app = express ( ) ;
You can’t perform that action at this time.
0 commit comments