@lelantos-org/sdk / index / HttpClientOptions
Interface: HttpClientOptions โ
Defined in: @lelantos-org/sdk/dist/core/http.d.ts:2
Extended by โ
Properties โ
backoffMs? โ
optional backoffMs?: number;Defined in: @lelantos-org/sdk/dist/core/http.d.ts:8
Base backoff, doubled per attempt, ยฑ25% jitter. Default 250.
fetchImpl? โ
optional fetchImpl?: (input, init?) => Promise<Response>;Defined in: @lelantos-org/sdk/dist/core/http.d.ts:10
Defaults to bound globalThis.fetch.
Parameters โ
| Parameter | Type |
|---|---|
input | RequestInfo | URL |
init? | RequestInit |
Returns โ
Promise<Response>
onPaymentRequired? โ
optional onPaymentRequired?: (res, url, init) => Promise<Response | null>;Defined in: @lelantos-org/sdk/dist/core/http.d.ts:30
Invoked when the server returns 402, before NetworkError is thrown. Return a Response to replace the 402 (its ok/non-ok status is then honored) or null to fall through to the normal error path. Owns its own retry semantics โ the outer retry loop does NOT loop on the returned response.
Parameters โ
| Parameter | Type |
|---|---|
res | Response |
url | string |
init | RequestInit | undefined |
Returns โ
Promise<Response | null>
onRetry? โ
optional onRetry?: (info) => void;Defined in: @lelantos-org/sdk/dist/core/http.d.ts:17
Observability hook fired before each backoff. Must not throw.
Parameters โ
| Parameter | Type |
|---|---|
info | { attempt: number; delayMs: number; method: string; url: string; } |
info.attempt | number |
info.delayMs | number |
info.method | string |
info.url | string |
Returns โ
void
retries? โ
optional retries?: number;Defined in: @lelantos-org/sdk/dist/core/http.d.ts:6
Additional attempts after the first. Default 3.
retryOnSubmit? โ
optional retryOnSubmit?: boolean;Defined in: @lelantos-org/sdk/dist/core/http.d.ts:15
Retry POST/PUT/PATCH/DELETE (which carry an Idempotency-Key). Default true. See the module header before turning this off โ or on.
timeoutMs? โ
optional timeoutMs?: number;Defined in: @lelantos-org/sdk/dist/core/http.d.ts:4
Per-attempt deadline. Default 15 000 for GET, 30 000 for POST.