Skip to content

refactor: reuse wrapRequestBody in RedirectHandler#4992

Merged
mcollina merged 1 commit intonodejs:mainfrom
trivikr:wrap-request-body-in-redirect-handler
Apr 8, 2026
Merged

refactor: reuse wrapRequestBody in RedirectHandler#4992
mcollina merged 1 commit intonodejs:mainfrom
trivikr:wrap-request-body-in-redirect-handler

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented Apr 8, 2026

This relates to...

Reuse wrapRequestBody written in #3294

Rationale

RedirectHandler duplicated request body wrapping and disturbance tracking logic that already exists in lib/core/util.js as wrapRequestBody(). Reusing the shared helper brings redirect handling onto the same path as retry handling and reduces the risk of the two implementations drifting.

Changes

  • Replace the redirect-local body wrapping logic with util.wrapRequestBody() in RedirectHandler
  • Remove the private BodyAsyncIterable and duplicated stream disturbance handling from redirect-handler.js
  • Add redirect coverage for async iterable request bodies to verify the shared wrapping behavior

Features

N/A

Bug Fixes

N/A

Breaking Changes and Deprecations

N/A

Status

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.92%. Comparing base (51cc6cb) to head (b852e35).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4992      +/-   ##
==========================================
+ Coverage   92.86%   92.92%   +0.05%     
==========================================
  Files         110      110              
  Lines       35788    35738      -50     
==========================================
- Hits        33236    33210      -26     
+ Misses       2552     2528      -24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina merged commit 743aa89 into nodejs:main Apr 8, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants