File tree Expand file tree Collapse file tree 3 files changed +2
-25
lines changed
Expand file tree Collapse file tree 3 files changed +2
-25
lines changed Original file line number Diff line number Diff line change 44This incorporates all changes after 4.13.1 up to 4.14.0.
55
66 * remove:
7+ - ` res.json(status, obj) ` signature - use ` res.status(status).json(obj) `
78 - ` res.vary() ` (no arguments) -- provide a field name as an argument
89
9105.0.0-alpha.2 / 2015-07-06
Original file line number Diff line number Diff line change @@ -203,20 +203,11 @@ res.send = function send(body) {
203203 */
204204
205205res . json = function json ( obj ) {
206- var val = obj ;
207-
208- // 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- }
214-
215206 // settings
216207 var app = this . app ;
217208 var replacer = app . get ( 'json replacer' ) ;
218209 var spaces = app . get ( 'json spaces' ) ;
219- var body = stringify ( val , replacer , spaces ) ;
210+ var body = stringify ( obj , replacer , spaces ) ;
220211
221212 // content-type
222213 if ( ! this . get ( 'Content-Type' ) ) {
Original file line number Diff line number Diff line change @@ -145,19 +145,4 @@ describe('res', function(){
145145 } )
146146 } )
147147 } )
148-
149- describe ( '.json(status, object)' , function ( ) {
150- it ( 'should respond with json and set the .statusCode' , function ( done ) {
151- var app = express ( ) ;
152-
153- app . use ( function ( req , res ) {
154- res . json ( 201 , { id : 1 } ) ;
155- } ) ;
156-
157- request ( app )
158- . get ( '/' )
159- . expect ( 'Content-Type' , 'application/json; charset=utf-8' )
160- . expect ( 201 , '{"id":1}' , done )
161- } )
162- } )
163148} )
You can’t perform that action at this time.
0 commit comments