From d7d8599f7ce7a6fe677aa47fc6e2cd6eb0eb42cf Mon Sep 17 00:00:00 2001 From: Chengzhong Wu Date: Mon, 19 May 2025 15:57:27 +0100 Subject: [PATCH] inspector: add protocol method Network.dataReceived PR-URL: https://github.com/nodejs/node/pull/58001 Refs: https://github.com/nodejs/node/issues/53946 Refs: https://github.com/nodejs/undici/issues/4166 Reviewed-By: James M Snell --- doc/api/inspector.md | 13 ++ lib/inspector.js | 1 + src/inspector/network_agent.cc | 91 +++++++++++ src/inspector/network_agent.h | 16 ++ src/inspector/node_protocol.pdl | 24 +++ src/inspector/node_string.cc | 66 ++++++++ src/inspector/node_string.h | 55 +++++-- .../test-inspector-emit-protocol-event.js | 12 +- .../test-inspector-network-data-received.js | 146 ++++++++++++++++++ 9 files changed, 410 insertions(+), 14 deletions(-) create mode 100644 test/parallel/test-inspector-network-data-received.js diff --git a/doc/api/inspector.md b/doc/api/inspector.md index ea5e9b032a4..9ac7316c826 100644 --- a/doc/api/inspector.md +++ b/doc/api/inspector.md @@ -511,6 +511,19 @@ inspector.Network.requestWillBeSent({ }); ``` +### `inspector.Network.dataReceived([params])` + + + +* `params` {Object} + +This feature is only available with the `--experimental-network-inspection` flag enabled. + +Broadcasts the `Network.dataReceived` event to connected frontends, or buffers the data if +`Network.streamResourceContent` command was not invoked for the given request yet. + ### `inspector.Network.requestWillBeSent([params])`