RetryConfig
Defined in: src/core/types.ts:262
Properties
Section titled “Properties”maxRetries?
Section titled “maxRetries?”
optionalmaxRetries?:number
Defined in: src/core/types.ts:266
Retries after the first attempt. MaxRetriesExceededError.attempts is
total executions, i.e. maxRetries + 1.
Default
Section titled “Default”backoff?
Section titled “backoff?”
optionalbackoff?:BackoffOptions|BackoffFn
Defined in: src/core/types.ts:268
Default
Section titled “Default”{ baseDelayMs: 200, maxDelayMs: 30_000, jitter: true }
retryOnStatus?
Section titled “retryOnStatus?”
optionalretryOnStatus?:number[]
Defined in: src/core/types.ts:271
HTTP status codes that trigger retry (e.g. 408, 429, 500, 502, 503, 504).
Default
Section titled “Default”idempotent?
Section titled “idempotent?”
optionalidempotent?:boolean
Defined in: src/core/types.ts:274
Allows retrying non-idempotent methods (POST/PATCH). An
Idempotency-Key header also enables retries. Default: false.
idempotencyKey?
Section titled “idempotencyKey?”
optionalidempotencyKey?:boolean| (() =>string)
Defined in: src/core/types.ts:285
Sends an Idempotency-Key header so a POST/PATCH can be retried safely.
Off by default. true generates a random v4 UUID key; a
function returns your own key. One key is generated per request, before
the first attempt, and the same key is sent on every attempt. Only
requests with a non-idempotent method (not GET, HEAD, OPTIONS, PUT or
DELETE) get one, and a request that already has an Idempotency-Key
non-empty header keeps the caller’s value. The key is added even when
maxRetries is 0. A generator that throws or returns a blank or
non-string value fails the request with a ConfigurationError.
Default: false.
retryWhen?
Section titled “retryWhen?”
optionalretryWhen?: (error,attempt) =>boolean
Defined in: src/core/types.ts:294
Optional predicate to decide whether a failed attempt should be retried. Called exactly once per failed attempt that could still be retried, with the zero-based attempt number:
- 0 = the first attempt (called client-side before the retry loop)
- 1, 2, … = retries (called inside the loop, after attempt 0)
Returning
falsesurfaces the error immediately without retrying. Not called after the final attempt when no retries remain — there is nothing left to decide.
Parameters
Section titled “Parameters”attempt
Section titled “attempt”number
Returns
Section titled “Returns”boolean
