Type Alias FetchOptions

Source
Expand description

Options controlling HTTP fetch behavior (timeouts, retries, cancellation).

type FetchOptions = {
    body?: string;
    dispatcher?: Dispatcher;
    headers?: Record<string, string>;
    method?: string;
    retryBaseMs?: number;
    retryCount?: number;
    signal?: AbortSignal;
    stallTimeoutMs?: number;
    timeoutMs?: number;
}

Properties§

body

Request body (for POST).

dispatcher

Custom undici Dispatcher for connection control (proxies, TLS, connection pooling). Defaults to an HTTP/1.1-only agent with no keep-alive.

headers

Custom HTTP headers for fetch requests.

method

HTTP method.

retryBaseMs

Base delay for exponential backoff in ms.

retryCount

Retries after initial attempt.

signal

AbortSignal for cooperative cancellation.

stallTimeoutMs

Stall timeout: abort if no data for this long.

timeoutMs

Per-request timeout in ms.