Skip to content

Conversation

@RaisinTen
Copy link
Member

Now, we can track the request and response bodies of HTTP/2 calls through the Network tab of Chrome DevTools for Node.js.

Depends on: #60480

Refs: #53946


Demo

demo.mov

Signed-off-by: Darshan Sen <raisinten@gmail.com>
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/http2
  • @nodejs/inspector
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added http2 Issues or PRs related to the http2 subsystem. needs-ci PRs that need a full CI run. labels Oct 29, 2025
@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

❌ Patch coverage is 76.28866% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.57%. Comparing base (ba7cdf4) to head (c1a3ef9).
⚠️ Report is 46 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/inspector/network_http2.js 71.95% 23 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #60483    +/-   ##
========================================
  Coverage   88.56%   88.57%            
========================================
  Files         704      704            
  Lines      207774   207955   +181     
  Branches    40027    40065    +38     
========================================
+ Hits       184020   184199   +179     
+ Misses      15800    15786    -14     
- Partials     7954     7970    +16     
Files with missing lines Coverage Δ
lib/internal/http2/core.js 95.22% <100.00%> (+0.01%) ⬆️
lib/internal/inspector/network_http2.js 87.69% <71.95%> (-7.26%) ⬇️

... and 50 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

},
});

stream.on('data', (chunk) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attaching a data listener puts the stream into flowing mode. This is a significant side-effect and could break user code if they didn't attach the data listener immediately.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@legendecas good catch, what do you think about using the readable stream channel I pushed in the last commit?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have opened a separate PR for this #60514

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just use EE.prototype.on.call(stream, 'data', ...)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, pushed the change.

This would mean that network inspection of HTTP/2 calls would be slightly different from that of fetch, as it won't show the response body unless the user code actually reads it, whereas fetch calls display it even if the user code doesn't read it.

@legendecas legendecas added the inspector Issues and PRs related to the V8 inspector protocol label Oct 29, 2025
…le stream

Signed-off-by: Darshan Sen <raisinten@gmail.com>
Signed-off-by: Darshan Sen <raisinten@gmail.com>
Signed-off-by: Darshan Sen <raisinten@gmail.com>
Signed-off-by: Darshan Sen <raisinten@gmail.com>
Signed-off-by: Darshan Sen <raisinten@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

http2 Issues or PRs related to the http2 subsystem. inspector Issues and PRs related to the V8 inspector protocol needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants