test: add regression test for issue #1373 — default headersTimeout 300s#5467
Open
SNTL84 wants to merge 1 commit into
Open
test: add regression test for issue #1373 — default headersTimeout 300s#5467SNTL84 wants to merge 1 commit into
SNTL84 wants to merge 1 commit into
Conversation
…t 300s Verifies that undici's fetch does not throw HeadersTimeoutError for a server that responds after 35s, confirming the 300e3ms default is in effect and the old 30s behaviour does not regress. Fixes: nodejs#1373
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5467 +/- ##
=======================================
Coverage 93.46% 93.46%
=======================================
Files 110 110
Lines 37115 37115
=======================================
Hits 34690 34690
Misses 2425 2425 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
What
Adds a regression test
test/issue-1373-default-timeout.jsthat confirms undici's defaultheadersTimeoutis300e3ms (300s), not the old 30s that caused issues in #1373.Why
Issue #1373 was raised because the default fetch timeout was 30s, causing failures for slow-responding servers. The fix (aligning with Chrome's 300s default) appears to have been applied in:
types/client.d.ts—Default: 300e3 msdocs/docs/api/Client.md—bodyTimeoutdefault300e3However there was no regression test to prevent this from silently reverting. This PR fills that gap.
Test Approach
The test spins up an HTTP server that intentionally delays its response by 35 seconds — beyond the old 30s default but well within the 300s default. A
HeadersTimeoutErrorwould signal a regression.Checklist
Contributed by Milan Soni (SNTL84) · github.com/SNTL84
Open to OSS sponsorship & consulting — AI workflows, automation & full-stack builds · desidevloper.com