Skip to content

Type Alias: ValifetchBaseOptions ​

ValifetchBaseOptions = Omit<RequestInit, "body" | "method" | "window"> & object

Defined in: src/types/options.ts:203

Base options without schemas (for internal use)

Type Declaration ​

debug? ​

optional debug?: DebugOption

Enable structured debug logging of request lifecycle events. Pass true to emit via console.debug, or a function to handle events directly.

dedupe? ​

optional dedupe?: boolean

Deduplicate concurrent identical requests. The dedupe key is method plus the fully-resolved URL — prefixUrl + path params + merged search params, computed from the raw pre-validation values — scoped per instance (including instances created via create() with no arguments, each of which gets its own cache). The key deliberately excludes headers, the request body, and schemas, so two calls that differ only by header or body are treated as identical and collapsed into one in-flight request — avoid enabling dedupe for such calls, and avoid it on non-idempotent methods (POST, PATCH, DELETE) where collapsing distinct requests would be incorrect. Calling .cancel() on a deduplicated promise aborts the shared request for every caller awaiting it.

Default ​

ts
false

hooks? ​

optional hooks?: Hooks

Hooks for request lifecycle

onDownloadProgress? ​

optional onDownloadProgress?: (event) => void

Callback fired as response body bytes are received. Not called when responseType is 'stream', 'raw' or 'sse' — the caller owns the stream in those modes.

Parameters ​

event ​

DownloadProgressEvent

Returns ​

void

prefixUrl? ​

optional prefixUrl?: string

Base URL prefix for all requests. Resolved request paths must stay under it (a .. escape throws a TypeError). Must not contain a query string or fragment (?/# throws a TypeError); use searchParams for defaults.

retry? ​

optional retry?: RetryOptions | number | false

Retry configuration or limit number

searchParams? ​

optional searchParams?: SearchParamsInit

Search/query parameters.

Instance-level values act as defaults: per-request params are merged on top, and a key present in both is taken from the request (all instance-level entries for that key are dropped). A request key explicitly set to undefined/null removes the instance default for that key entirely, rather than leaving it in place.

sseMaxEventSize? ​

optional sseMaxEventSize?: number

Largest single Server-Sent Event the responseType: 'sse' parser buffers, in UTF-16 code units (one per ASCII character). A pending event that grows past it cancels the stream and throws a PARSE_ERROR, bounding memory against a server that never sends an event boundary. Infinity disables the cap; a non-number, NaN or negative value falls back to the default. Allowed at instance level (merged by create/extend) and per call; the per-call value wins. Ignored for every other responseType.

Default ​

ts
16777216 (16 MiB)

throwHttpErrors? ​

optional throwHttpErrors?: boolean

Throw on non-2xx status codes (default: true)

timeout? ​

optional timeout?: number

Request timeout in milliseconds.

Default ​

undefined — requests never time out; 0 also disables the timeout

validateRequest? ​

optional validateRequest?: boolean

Enable/disable request body/params/search validation (default: true)

validateResponse? ​

optional validateResponse?: boolean

Enable/disable response schema validation (default: true)

Released under the MIT License. Built with Claude Code.