Interface RequestConfig

interface RequestConfig {
    body?: BodyInit;
    cache?: boolean | CacheConfig;
    credentials?: RequestCredentials;
    data?: unknown;
    dispatcher?: Dispatcher;
    duplex?: "half";
    errorInterceptors?: ErrorInterceptor[];
    headers?: HeadersInit;
    integrity?: string;
    keepalive?: boolean;
    method?: string;
    mode?: RequestMode;
    onAbort?: (() => void);
    onDownloadProgress?: ((loaded, total) => void);
    onError?: ((error) => void);
    onFinally?: (() => void);
    onSuccess?: ((data) => void);
    params?: Record<PropertyKey, any>;
    redirect?: RequestRedirect;
    referrer?: string;
    referrerPolicy?: ReferrerPolicy;
    requestInterceptors?: RequestInterceptor[];
    responseInterceptors?: ResponseInterceptor<any, any>[];
    retry?: number;
    retryDelay?: number;
    signal?: AbortSignal;
    sse?: boolean | SSEConfig;
    timeout?: number;
    window?: null;
}

Hierarchy

  • RequestInit
    • RequestConfig

Properties

body?: BodyInit
cache?: boolean | CacheConfig

Response cache configuration. true = default TTL (5000ms).

credentials?: RequestCredentials
data?: unknown
dispatcher?: Dispatcher
duplex?: "half"
errorInterceptors?: ErrorInterceptor[]
headers?: HeadersInit
integrity?: string
keepalive?: boolean
method?: string
mode?: RequestMode
onAbort?: (() => void)

Type declaration

    • (): void
    • Returns void

onDownloadProgress?: ((loaded, total) => void)

Download progress callback. Receives (loadedBytes, totalBytes).

Type declaration

    • (loaded, total): void
    • Parameters

      • loaded: number
      • total: number

      Returns void

onError?: ((error) => void)

Type declaration

    • (error): void
    • Parameters

      • error: unknown

      Returns void

onFinally?: (() => void)

Type declaration

    • (): void
    • Returns void

onSuccess?: ((data) => void)

Type declaration

    • (data): void
    • Parameters

      • data: unknown

      Returns void

params?: Record<PropertyKey, any>
redirect?: RequestRedirect
referrer?: string
referrerPolicy?: ReferrerPolicy
requestInterceptors?: RequestInterceptor[]
responseInterceptors?: ResponseInterceptor<any, any>[]
retry?: number

Max retry count on failure. 0 = no retry.

retryDelay?: number

Delay between retries in milliseconds.

signal?: AbortSignal
sse?: boolean | SSEConfig

SSE configuration. Enables Server-Sent Events mode when provided.

timeout?: number

Request timeout in milliseconds. 0 or undefined = no timeout.

window?: null