ResilientFetchOptions
Defined in: src/fetch.ts:62
Options shared by createResilientFetch and the axios integration.
Extends
Section titled “Extends”HttpResilienceOptions<Response>
Properties
Section titled “Properties”attemptTimeout?
Section titled “attemptTimeout?”
optionalattemptTimeout?:Duration
Defined in: src/fetch.ts:41
Budget per attempt. Default 10 s.
Inherited from
Section titled “Inherited from”HttpResilienceOptions.attemptTimeout
circuitBreaker?
Section titled “circuitBreaker?”
optionalcircuitBreaker?:false|Omit<CircuitBreakerOptions<Response>,"shouldHandle">
Defined in: src/fetch.ts:47
Circuit breaker options merged over the defaults (50% failures over the last 20 calls, 10 s break). false disables it.
Inherited from
Section titled “Inherited from”HttpResilienceOptions.circuitBreaker
concurrency?
Section titled “concurrency?”
optionalconcurrency?:number|ConcurrencyLimiterOptions
Defined in: src/fetch.ts:49
Max attempts in flight per key (bulkhead), e.g. 20 or { permitLimit: 20, queueLimit: 100 }. Default: no limit.
Inherited from
Section titled “Inherited from”HttpResilienceOptions.concurrency
fetch?
Section titled “fetch?”
optionalfetch?: {(input,init?):Promise<Response>; (input,init?):Promise<Response>; }
Defined in: src/fetch.ts:64
The fetch to wrap. Default globalThis.fetch.
Call Signature
Section titled “Call Signature”(
input,init?):Promise<Response>
Parameters
Section titled “Parameters”URL | RequestInfo
RequestInit
Returns
Section titled “Returns”Promise<Response>
Call Signature
Section titled “Call Signature”(
input,init?):Promise<Response>
Parameters
Section titled “Parameters”string | URL | Request
RequestInit
Returns
Section titled “Returns”Promise<Response>
maxPipelines?
Section titled “maxPipelines?”
optionalmaxPipelines?:number
Defined in: src/fetch.ts:56
Max per-key pipelines kept; the least recently used is dropped beyond it. Default 100.
Inherited from
Section titled “Inherited from”HttpResilienceOptions.maxPipelines
optionalname?:string
Defined in: src/fetch.ts:37
Labels telemetry. Per-host pipelines are named <name>/<key>.
Inherited from
Section titled “Inherited from”onBeforeAttempt?
Section titled “onBeforeAttempt?”
optionalonBeforeAttempt?: (request,context) =>MaybePromise<void|Request>
Defined in: src/fetch.ts:68
Called before every attempt with a fresh Request; return a replacement, e.g. with a refreshed auth token.
Parameters
Section titled “Parameters”request
Section titled “request”Request
context
Section titled “context”Returns
Section titled “Returns”MaybePromise<void | Request>
pipeline?
Section titled “pipeline?”
optionalpipeline?:ResiliencePipeline<Response,any>
Defined in: src/fetch.ts:66
Use your own pipeline instead of the built-in one (per-request retries, timeout, retryOn and per-host keys are then ignored).
pipelineKey?
Section titled “pipelineKey?”
optionalpipelineKey?: (url) =>string
Defined in: src/fetch.ts:54
Which requests share a circuit breaker and limiter. Default url => url.origin: one per host, so a dead host doesn’t
open the breaker for the others. () => 'all' shares one.
Parameters
Section titled “Parameters”URL
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”HttpResilienceOptions.pipelineKey
retry?
Section titled “retry?”
optionalretry?:false|Omit<RetryOptions<Response>,"shouldHandle">
Defined in: src/fetch.ts:43
Retry options merged over the defaults (3 retries, exponential backoff from 200 ms, full jitter, Retry-After honoured). false disables retries.
Inherited from
Section titled “Inherited from”retryOn?
Section titled “retryOn?”
optionalretryOn?:RetryOn<Response>
Defined in: src/fetch.ts:45
What to retry. Default: network errors, timeouts and 408/429/500/502/503/504.
Inherited from
Section titled “Inherited from”retryUnsafeMethods?
Section titled “retryUnsafeMethods?”
optionalretryUnsafeMethods?:boolean
Defined in: src/fetch.ts:58
Retry POST / PATCH without an Idempotency-Key header too. Default false: they could run twice.
Inherited from
Section titled “Inherited from”HttpResilienceOptions.retryUnsafeMethods
timeProvider?
Section titled “timeProvider?”
optionaltimeProvider?:TimeProvider
Defined in: src/fetch.ts:59
Inherited from
Section titled “Inherited from”HttpResilienceOptions.timeProvider
totalTimeout?
Section titled “totalTimeout?”
optionaltotalTimeout?:Duration
Defined in: src/fetch.ts:39
Budget for the whole call, retries included. Default 30 s.