@@ -205,7 +205,9 @@ describe('compression()', function () {
205
205
client = res
206
206
assert . strictEqual ( res . headers [ 'content-encoding' ] , 'gzip' )
207
207
res . pause ( )
208
- res . on ( 'end' , cb )
208
+ res . on ( 'end' , function ( ) {
209
+ server . close ( cb )
210
+ } )
209
211
pressure ( )
210
212
} )
211
213
. end ( )
@@ -258,7 +260,9 @@ describe('compression()', function () {
258
260
client = res
259
261
shouldNotHaveHeader ( 'Content-Encoding' ) ( res )
260
262
res . pause ( )
261
- res . on ( 'end' , cb )
263
+ res . on ( 'end' , function ( ) {
264
+ server . close ( cb )
265
+ } )
262
266
pressure ( )
263
267
} )
264
268
. end ( )
@@ -594,7 +598,10 @@ describe('compression()', function () {
594
598
. get ( '/' )
595
599
. set ( 'Accept-Encoding' , 'gzip' )
596
600
. request ( )
597
- . on ( 'response' , unchunk ( 'gzip' , onchunk , done ) )
601
+ . on ( 'response' , unchunk ( 'gzip' , onchunk , function ( err ) {
602
+ if ( err ) return done ( err )
603
+ server . close ( done )
604
+ } ) )
598
605
. end ( )
599
606
} )
600
607
@@ -617,7 +624,10 @@ describe('compression()', function () {
617
624
. get ( '/' )
618
625
. set ( 'Accept-Encoding' , 'gzip' )
619
626
. request ( )
620
- . on ( 'response' , unchunk ( 'gzip' , onchunk , done ) )
627
+ . on ( 'response' , unchunk ( 'gzip' , onchunk , function ( err ) {
628
+ if ( err ) return done ( err )
629
+ server . close ( done )
630
+ } ) )
621
631
. end ( )
622
632
} )
623
633
@@ -640,7 +650,10 @@ describe('compression()', function () {
640
650
. get ( '/' )
641
651
. set ( 'Accept-Encoding' , 'deflate' )
642
652
. request ( )
643
- . on ( 'response' , unchunk ( 'deflate' , onchunk , done ) )
653
+ . on ( 'response' , unchunk ( 'deflate' , onchunk , function ( err ) {
654
+ if ( err ) return done ( err )
655
+ server . close ( done )
656
+ } ) )
644
657
. end ( )
645
658
} )
646
659
} )
0 commit comments