@@ -180,26 +180,22 @@ function onClientStreamFinish({ stream, headers }) {
180180 charset,
181181 } ,
182182 } ) ;
183- }
184-
185- /**
186- * When a chunk of the response body has been received, cache it until `getResponseBody` request
187- * https://chromedevtools.github.io/devtools-protocol/1-3/Network/#method-getResponseBody or
188- * stream it with `streamResourceContent` request.
189- * https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-streamResourceContent
190- * @param {{ stream: import('http2').ClientHttp2Stream, chunk: Buffer } } event
191- */
192- function onStreamReadableAddChunk ( { stream, chunk } ) {
193- if ( typeof stream [ kInspectorRequestId ] !== 'string' ) {
194- return ;
195- }
196183
197- Network . dataReceived ( {
198- requestId : stream [ kInspectorRequestId ] ,
199- timestamp : getMonotonicTime ( ) ,
200- dataLength : chunk . byteLength ,
201- encodedDataLength : chunk . byteLength ,
202- data : chunk ,
184+ stream . on ( 'data' , ( chunk ) => {
185+ /**
186+ * When a chunk of the response body has been received, cache it until `getResponseBody` request
187+ * https://chromedevtools.github.io/devtools-protocol/1-3/Network/#method-getResponseBody or
188+ * stream it with `streamResourceContent` request.
189+ * https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-streamResourceContent
190+ */
191+
192+ Network . dataReceived ( {
193+ requestId : stream [ kInspectorRequestId ] ,
194+ timestamp : getMonotonicTime ( ) ,
195+ dataLength : chunk . byteLength ,
196+ encodedDataLength : chunk . byteLength ,
197+ data : chunk ,
198+ } ) ;
203199 } ) ;
204200}
205201
@@ -232,5 +228,4 @@ module.exports = registerDiagnosticChannels([
232228 [ 'http2.client.stream.close' , onClientStreamClose ] ,
233229 [ 'http2.client.stream.bodyChunkSent' , onClientStreamBodyChunkSent ] ,
234230 [ 'http2.client.stream.bodySent' , onClientStreamBodySent ] ,
235- [ 'stream.readable.addChunk' , onStreamReadableAddChunk ] ,
236231] ) ;
0 commit comments