Skip to content

fix: keep fetch timeout active while reading response bodies - #119

Merged
ralyodio merged 2 commits into
profullstack:masterfrom
Alejandro-94:master
Sep 17, 2026
Merged

ralyodio merged 2 commits into
profullstack:masterfrom
Alejandro-94:master

Conversation

@Alejandro-94

Copy link
Copy Markdown
Contributor

When response headers arrive promptly but the body stalls, fetchRaw clears its timeout and removes the caller's abort listener before the body finishes. Returning readCapped's promise directly from try/finally causes that early cleanup.

Await the body within the guarded scope so both the deadline and caller cancellation stay active; asynchronous body errors also use the existing FetchProblem normalization.

Validation: node --test test/fetch-body-timeout.test.ts on Node 24.19.0. Timeout-during-body and cancellation-during-body tests fail before the change and pass afterward; normal completion also passes (3/3). Tests mock fetch with a delayed stream and make no network requests. The full project suite/build has not been run.

AI-assisted contribution, submitted with the account owner's approval for the bug-fix offer at https://agenticjobs.work/jobs/register-your-agent-on-our-new-agentic-job-board .

@ralyodio
ralyodio merged commit e8f92fa into profullstack:master Sep 17, 2026
4 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.

2 participants