Type Alias: RetryOptions
RetryOptions =
object
Defined in: src/types/options.ts:71
Retry configuration. A per-request or child-instance retry value replaces the instance retry object entirely (fields, including maxRetryAfter, are not merged with the parent's); unset fields take the built-in defaults.
Properties
delay?
optionaldelay?: (attemptCount) =>number
Defined in: src/types/options.ts:84
Custom delay function returning the milliseconds to wait before the next attempt. attemptCount is 0-based, so delay(0) precedes the first retry.
Parameters
attemptCount
number
Returns
number
Default
(attemptCount) => 0.3 * 2 ** attemptCount seconds, plus up to 20% jitter, capped at 30 slimit?
optionallimit?:number
Defined in: src/types/options.ts:73
Max retry attempts (default: 2)
maxRetryAfter?
optionalmaxRetryAfter?:number
Defined in: src/types/options.ts:103
Longest server-sent Retry-After delay, in milliseconds, the client is willing to wait. When a retryable response asks for longer (integer seconds or HTTP-date), the request is NOT retried: the response is handled as if retries were exhausted (an HTTP_ERROR through beforeError, or returned as-is with throwHttpErrors: false). The check runs after shouldRetry says "retry" and before beforeRetry, so no beforeRetry hook or retry debug event fires for it. Infinity honours any value (the wait itself is still clamped to the ~24.8-day setTimeout limit); a non-number, NaN or negative value falls back to the default. A malformed Retry-After (not all-digit seconds, not an HTTP-date) is ignored in favour of delay.
A per-request or child-instance retry value replaces the instance retry object entirely (fields are not merged), so restate maxRetryAfter there if you changed it.
Default
60000methods?
optionalmethods?:HttpMethod[]
Defined in: src/types/options.ts:75
Methods to retry (default: GET, PUT, HEAD, DELETE, OPTIONS)
shouldRetry?
optionalshouldRetry?: (context) =>boolean|undefined|Promise<boolean|undefined>
Defined in: src/types/options.ts:112
Custom retry predicate. Return true to retry even when statusCodes/methods would not, false to never retry this failure, or undefined to defer to the built-in status-code + method check. Always bounded by limit. Runs before beforeRetry hooks and only for failed responses (response.ok === false) or network errors. May be async (e.g. inspect response.clone().json()). A throwing predicate aborts the request with that error.
Parameters
context
Returns
boolean | undefined | Promise<boolean | undefined>
statusCodes?
optionalstatusCodes?:number[]
Defined in: src/types/options.ts:77
Status codes to retry (default: 408, 413, 429, 500, 502, 503, 504)