Skip to content

fix(fetch): cancel request.body instead of source stream#10702

Merged
jasonsaayman merged 1 commit intoaxios:v1.xfrom
zoontek:fix-fetch-probe-cancel-locked-stream
Apr 13, 2026
Merged

fix(fetch): cancel request.body instead of source stream#10702
jasonsaayman merged 1 commit intoaxios:v1.xfrom
zoontek:fix-fetch-probe-cancel-locked-stream

Conversation

@zoontek
Copy link
Copy Markdown
Contributor

@zoontek zoontek commented Apr 13, 2026

The Request constructor extracts and locks the ReadableStream passed as body, so calling cancel() on the original reference rejects with a TypeError per spec. This PR cancels the transferred stream via request.body instead, which achieves the same goal without producing an unhandled rejection.

Related #7515
Fixes expo/expo#44382


Summary by cubic

Cancel the transferred request body (request.body) in the fetch adapter’s request stream probe to avoid TypeErrors from cancelling the original source stream. This removes unhandled rejections while keeping the probe behavior the same.

Description

Docs

  • No user-facing or API changes. No docs updates needed.

Testing

  • No tests added or modified.
  • Suggested: add a regression test to ensure the probe does not produce unhandled rejections and still returns the expected result when the body is locked by Request.

Written for commit eec1e42. Summary will update on new commits.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@zoontek zoontek changed the title fix(fetch): cancel request.body instead of source stream in request stream probe fix(fetch): cancel request.body instead of source stream Apr 13, 2026
@jasonsaayman jasonsaayman added priority::high A high priority issue commit::fix The PR is related to a bugfix labels Apr 13, 2026
@jasonsaayman
Copy link
Copy Markdown
Member

Thanks @zoontek!

@jasonsaayman jasonsaayman merged commit 7a8bea2 into axios:v1.x Apr 13, 2026
28 of 29 checks passed
@zoontek zoontek deleted the fix-fetch-probe-cancel-locked-stream branch April 13, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit::fix The PR is related to a bugfix priority::high A high priority issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[jest-expo] jest tests fail with axios@^1.14.0

2 participants