Documentation
    Preparing search index...

    Interface JSONRequestOptions<T>

    interface JSONRequestOptions<T = unknown> {
        body?: Jsonifiable;
        fetch?: {
            (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
            (input: string | URL | Request, init?: RequestInit): Promise<Response>;
        };
        headers?: HeadersInit;
        keepalive?: boolean;
        method?: string;
        onResponse?: (
            response: Response,
            request: Request,
        ) => void | Response | Promise<void | Response>;
        poll?: boolean | PollOptions;
        redirect?: RequestRedirect;
        retry?: boolean | RetryOptions;
        schema?: StandardSchemaV1<unknown, T>;
        signal?: AbortSignal;
        timeout?: number | false;
    }

    Type Parameters

    • T = unknown
    Index
    body?: Jsonifiable
    fetch?: {
        (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
        (input: string | URL | Request, init?: RequestInit): Promise<Response>;
    }

    Type Declaration

      • (input: URL | RequestInfo, init?: RequestInit): Promise<Response>
      • Parameters

        • input: URL | RequestInfo
        • Optionalinit: RequestInit

        Returns Promise<Response>

      • (input: string | URL | Request, init?: RequestInit): Promise<Response>
      • Parameters

        • input: string | URL | Request
        • Optionalinit: RequestInit

        Returns Promise<Response>

    headers?: HeadersInit
    keepalive?: boolean
    method?: string
    onResponse?: (
        response: Response,
        request: Request,
    ) => void | Response | Promise<void | Response>
    poll?: boolean | PollOptions

    Poll responses that match the configured status codes.

    Set to true to use the default polling options.

    When combined with retry, a retryable failure during polling retries the whole polling loop, which starts again from the first poll. poll.limit applies per retry.

    false
    
    redirect?: RequestRedirect
    retry?: boolean | RetryOptions

    Retry failed requests.

    Set to true to use the default retry options.

    false
    
    schema?: StandardSchemaV1<unknown, T>
    signal?: AbortSignal
    timeout?: number | false

    Total time budget in milliseconds for the request, including every retry, poll and the delays between them. false disables the timeout.

    Without retry or poll the default is 5000. With them, the default is 5000 for each attempt they allow plus the retry backoff and poll intervals (59000 for poll: true, 18000 for retry: true). A function interval counts as 1000. There is no default timeout when that budget is unbounded, for example retries: Infinity.

    5000