File tree Expand file tree Collapse file tree 1 file changed +1
-6
lines changed Expand file tree Collapse file tree 1 file changed +1
-6
lines changed Original file line number Diff line number Diff line change @@ -320,10 +320,6 @@ ClientRequest.prototype.abort = function abort() {
320
320
// If we're aborting, we don't care about any more response data.
321
321
if ( this . res ) {
322
322
this . res . _dump ( ) ;
323
- } else {
324
- this . once ( 'response' , ( res ) => {
325
- res . _dump ( ) ;
326
- } ) ;
327
323
}
328
324
329
325
// In the event that we don't have a socket, we will pop out of
@@ -572,12 +568,11 @@ function parserOnIncomingClient(res, shouldKeepAlive) {
572
568
// Add our listener first, so that we guarantee socket cleanup
573
569
res . on ( 'end' , responseOnEnd ) ;
574
570
req . on ( 'prefinish' , requestOnPrefinish ) ;
575
- const handled = req . emit ( 'response' , res ) ;
576
571
577
572
// If the user did not listen for the 'response' event, then they
578
573
// can't possibly read the data, so we ._dump() it into the void
579
574
// so that the socket doesn't hang there in a paused state.
580
- if ( ! handled )
575
+ if ( req . aborted || ! req . emit ( 'response' , res ) )
581
576
res . _dump ( ) ;
582
577
583
578
if ( method === 'HEAD' )
You can’t perform that action at this time.
0 commit comments