Skip to content

fix: don't retry when retry is disabled#273

Merged
CahidArda merged 1 commit into
mainfrom
fix/retry-false-double-fetch
Jul 14, 2026
Merged

fix: don't retry when retry is disabled#273
CahidArda merged 1 commit into
mainfrom
fix/retry-false-double-fetch

Conversation

@CahidArda

Copy link
Copy Markdown
Contributor

Fixes #272

Summary

When HttpClient was configured with retry: false, a failing request still called fetch twice instead of once. The retry: false branch normalized to attempts: 1, but since #207 the request loop treats attempts as the number of retries after the initial attempt (index <= attempts), so 1 meant "one extra retry" rather than "one total attempt".

Changes

  • Normalize retry: false to attempts: 0 in src/client/http.ts, so a disabled-retry client performs exactly one fetch attempt. Object-form semantics ({ retries: N } → N retries after the initial attempt) are unchanged.

  • Add tests covering both cases: retry: false calls fetch exactly once, and { retries: 1 } calls it twice.

Testing

bun test src/client/http.test.ts — 3 pass, 0 fail (new tests plus the existing backoff-timing test).

@CahidArda CahidArda merged commit 3ad58d3 into main Jul 14, 2026
7 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.

retry: false still performs one retry after the initial failed fetch

1 participant