@@ -129,7 +129,7 @@ describe('HTTP/S', function() {
129129 } ) ;
130130
131131 describe ( 'on invocation' , function ( ) {
132- var capturedHttp , fakeRequest , fakeResponse , httpClient , requestSpy , sandbox ;
132+ var capturedHttp , fakeRequest , fakeResponse , httpClient , requestSpy , resumeSpy , sandbox ;
133133
134134 beforeEach ( function ( ) {
135135 sandbox = sinon . sandbox . create ( ) ;
@@ -145,8 +145,10 @@ describe('HTTP/S', function() {
145145 } } ;
146146 httpClient . get = httpClient . request ;
147147
148+ resumeSpy = sandbox . spy ( fakeResponse , 'resume' ) ;
148149 requestSpy = sandbox . spy ( httpClient , 'request' ) ;
149- capturedHttp = captureHTTPs ( httpClient , true ) ; } ) ;
150+ capturedHttp = captureHTTPs ( httpClient , true ) ;
151+ } ) ;
150152
151153 afterEach ( function ( ) {
152154 sandbox . restore ( ) ;
@@ -159,6 +161,16 @@ describe('HTTP/S', function() {
159161 resolveManualStub . should . have . been . calledWith ( options ) ;
160162 } ) ;
161163
164+ it ( 'should consume the response if no callback is provided by user' , function ( ) {
165+ capturedHttp . request ( httpOptions ) ; // no callback
166+ resumeSpy . should . have . been . calledOnce ;
167+ } ) ;
168+
169+ it ( 'should not consume the response if a callback is provided by user' , function ( ) {
170+ capturedHttp . request ( httpOptions , ( ) => { } ) ;
171+ resumeSpy . should . not . have . been . called ;
172+ } ) ;
173+
162174 it ( 'should create a new subsegment with name as hostname' , function ( ) {
163175 var options = { hostname : 'hostname' , path : '/' } ;
164176 capturedHttp . request ( options ) ;
@@ -385,7 +397,7 @@ describe('HTTP/S', function() {
385397 } , 50 ) ;
386398 } ) ;
387399
388- if ( process . version . startsWith ( 'v' ) && process . version >= 'v12' ) {
400+ if ( process . version . startsWith ( 'v' ) && process . version >= 'v12.17 ' ) {
389401 it ( 'should still re-emit if there are multiple errorMonitors attached' , function ( ) {
390402 fakeRequest . on ( events . errorMonitor , function ( ) { } ) ;
391403 fakeRequest . on ( events . errorMonitor , function ( ) { } ) ;
0 commit comments