fix: Abort rejected response requests - #363
Open
brennanbutler01 wants to merge 2 commits into
Open
brennanbutler01 wants to merge 2 commits into
brennanbutler01 wants to merge 2 commits into
Conversation
Close the request before reporting terminal response validation errors so unread response bodies cannot keep connections active. Add real-server coverage for rejected status and content type, preserving error details and closed state.
Place rejected-response tests beside response validation tests and use a separate fixture location. This avoids conflicts with the independent buffered-message fix without changing test behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A non-200 response or an invalid content type marks EventSource as closed without aborting its fetch. If the server keeps the response body open, the connection remains active. A later
close()cannot release it because that method returns early for an already-closed instance.Reproduced with a real local HTTP server on the installed 4.x release, published 5.1.1, and current
main. Route terminal connection failures throughclose()before emitting the existing error event. This aborts the request and clears its controller while preserving the error code, message, and no-reconnect behavior. No public API changes.Verification
git diff --checkpass.Verified on macOS with Node 24.13.0, Vitest 4.1.10, and Playwright 1.61.1. Firefox, iOS Safari, Deno, and happy-dom were not run. Local verification reused an isolated toolchain; dependency manifests and lockfiles are unchanged. Includes a patch changeset.
Prepared with OpenAI Codex assistance, including the reproduction, implementation, tests, and local review.