Skip to content

fix(fixRequestBody): wait for request stream to end - #1311

Merged
chimurai merged 1 commit into
masterfrom
fix-fixRequestBody
Oct 24, 2026
Merged

chimurai merged 1 commit into
masterfrom
fix-fixRequestBody

Conversation

@chimurai

@chimurai chimurai commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes
    • Request body handling now waits for the incoming request stream to finish before proceeding. This prevents requests with an unfinished stream from being handled prematurely and allows completed requests to proceed even when buffered data remains. The change helps ensure request bodies are handled consistently during proxying.

Use readableEnded to ensure the request body is
only reconstructed after the original stream has finished
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack β†’

Caution

Review failed

The pull request is closed.

Walkthrough

fixRequestBody now checks whether the original request stream has ended. Tests cover ended and unfinished streams, and the changelog records the update.

Changes: Request body stream guard

Layer / File(s) Summary
Stream completion guard
src/handlers/fix-request-body.ts, test/unit/fix-request-body.spec.ts, CHANGELOG.md
fixRequestBody now checks whether the request stream has ended. Tests verify that unfinished streams do not set Content-Length, write, or destroy the proxy request. The changelog records the change.

Priority: Not assessed

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: Minimal Β· up to 3df7f

The stream-completion fix is ready to merge.

Finishing Touches
πŸ“ Generate docstrings
  • Commit to this branch
  • Create a new PR
πŸ§ͺ Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix Β· Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Oct 24, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/http-proxy-middleware@1311

commit: 3df7f93

@chimurai
chimurai merged commit 412856f into master Oct 24, 2026
24 of 25 checks passed
@chimurai
chimurai deleted the fix-fixRequestBody branch October 24, 2026 17:32
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 96.833%. remained the same β€” fix-fixRequestBody into master

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.

2 participants