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() {
320320 // If we're aborting, we don't care about any more response data.
321321 if ( this . res ) {
322322 this . res . _dump ( ) ;
323- } else {
324- this . once ( 'response' , ( res ) => {
325- res . _dump ( ) ;
326- } ) ;
327323 }
328324
329325 // In the event that we don't have a socket, we will pop out of
@@ -572,12 +568,11 @@ function parserOnIncomingClient(res, shouldKeepAlive) {
572568 // Add our listener first, so that we guarantee socket cleanup
573569 res . on ( 'end' , responseOnEnd ) ;
574570 req . on ( 'prefinish' , requestOnPrefinish ) ;
575- const handled = req . emit ( 'response' , res ) ;
576571
577572 // If the user did not listen for the 'response' event, then they
578573 // can't possibly read the data, so we ._dump() it into the void
579574 // so that the socket doesn't hang there in a paused state.
580- if ( ! handled )
575+ if ( req . aborted || ! req . emit ( 'response' , res ) )
581576 res . _dump ( ) ;
582577
583578 if ( method === 'HEAD' )
You can’t perform that action at this time.
0 commit comments