Skip to content

fix: prevent pipeline body replay on redirect#5274

Open
mcollina wants to merge 1 commit intomainfrom
fix-5204-pipeline-redirect-body
Open

fix: prevent pipeline body replay on redirect#5274
mcollina wants to merge 1 commit intomainfrom
fix-5204-pipeline-redirect-body

Conversation

@mcollina
Copy link
Copy Markdown
Member

@mcollina mcollina commented May 9, 2026

This relates to...

Fixes #5204.

Rationale

undici.pipeline() uses a live writable-side request body that cannot be replayed safely. Redirect handling was only blocking redirects after the body had been consumed, which left a race where a redirect could be followed before any bytes were read.

Changes

  • mark pipeline request bodies as non-replayable from the start
  • add a regression test that forces a redirect before the pipeline body is consumed
  • wait for tspl completion in the redirect pipeline tests

Features

N/A

Bug Fixes

  • prevent pipeline request bodies from being replayed across redirects
  • make test/redirect-pipeline.js deterministic

Breaking Changes and Deprecations

None.

Status

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.28%. Comparing base (397bc13) to head (346b71c).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5274   +/-   ##
=======================================
  Coverage   93.27%   93.28%           
=======================================
  Files         110      110           
  Lines       36380    36388    +8     
=======================================
+ Hits        33934    33943    +9     
+ Misses       2446     2445    -1     

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

@trivikr
Copy link
Copy Markdown
Member

trivikr commented May 10, 2026

Needs rebase to include node 26 FFI build from https://www,github.com/nodejs/undici/pull/5275

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.

[flaky] test\redirect-pipeline.js

3 participants