File tree 2 files changed +12
-14
lines changed
2 files changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -933,7 +933,6 @@ function setMethods(res) {
933
933
file . on ( 'error' , onerror ) ;
934
934
file . on ( 'file' , onfile ) ;
935
935
file . on ( 'stream' , onstream ) ;
936
- onFinished ( res , onfinish ) ;
937
936
938
937
if ( options . headers ) {
939
938
// set headers on successful transfer
@@ -950,6 +949,8 @@ function setMethods(res) {
950
949
951
950
// pipe
952
951
file . pipe ( res ) ;
952
+
953
+ onFinished ( res , onfinish ) ;
953
954
}
954
955
955
956
return res ;
Original file line number Diff line number Diff line change @@ -292,21 +292,18 @@ describe('res', function(){
292
292
test . expect ( 200 , cb ) ;
293
293
} )
294
294
295
- // HEAD with http2 does not support response body.
296
- if ( ! process . env . HTTP2_TEST ) {
297
- it ( 'should invoke the callback without error when HEAD' , function ( done ) {
298
- var app = express ( ) ;
299
- var cb = after ( 2 , done ) ;
300
-
301
- app . use ( function ( req , res ) {
302
- res . sendFile ( path . resolve ( fixtures , 'name.txt' ) , cb ) ;
303
- } ) ;
295
+ it ( 'should invoke the callback without error when HEAD' , function ( done ) {
296
+ var app = express ( ) ;
297
+ var cb = after ( 2 , done ) ;
304
298
305
- request ( app )
306
- . head ( '/' )
307
- . expect ( 200 , cb ) ;
299
+ app . use ( function ( req , res ) {
300
+ res . sendFile ( path . resolve ( fixtures , 'name.txt' ) , cb ) ;
308
301
} ) ;
309
- }
302
+
303
+ request ( app )
304
+ . head ( '/' )
305
+ . expect ( 200 , cb ) ;
306
+ } ) ;
310
307
311
308
it ( 'should invoke the callback without error when 304' , function ( done ) {
312
309
var app = express ( ) ;
You can’t perform that action at this time.
0 commit comments