Skip to content

@lelantos-org/sdk / index / HttpClientOptions

Interface: HttpClientOptions โ€‹

Defined in: @lelantos-org/sdk/dist/core/http.d.ts:2

Extended by โ€‹

Properties โ€‹

backoffMs? โ€‹

ts
optional backoffMs?: number;

Defined in: @lelantos-org/sdk/dist/core/http.d.ts:8

Base backoff, doubled per attempt, ยฑ25% jitter. Default 250.


fetchImpl? โ€‹

ts
optional fetchImpl?: (input, init?) => Promise<Response>;

Defined in: @lelantos-org/sdk/dist/core/http.d.ts:10

Defaults to bound globalThis.fetch.

MDN Reference

Parameters โ€‹

ParameterType
inputRequestInfo | URL
init?RequestInit

Returns โ€‹

Promise<Response>


onPaymentRequired? โ€‹

ts
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 โ€‹

ParameterType
resResponse
urlstring
initRequestInit | undefined

Returns โ€‹

Promise<Response | null>


onRetry? โ€‹

ts
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 โ€‹

ParameterType
info{ attempt: number; delayMs: number; method: string; url: string; }
info.attemptnumber
info.delayMsnumber
info.methodstring
info.urlstring

Returns โ€‹

void


retries? โ€‹

ts
optional retries?: number;

Defined in: @lelantos-org/sdk/dist/core/http.d.ts:6

Additional attempts after the first. Default 3.


retryOnSubmit? โ€‹

ts
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? โ€‹

ts
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.

Lelantosno cookies ๐Ÿช ยท no tracking ๐Ÿ‘๏ธ ยท no accounts ๐Ÿ‘คwalletexplorer4536080GitHub