CSRF-X Auth Library - v1.0.3
    Preparing search index...

    Interface FetchOptions

    Extended fetch options with retry and timeout settings.

    All properties are optional. The timeoutMs, maxRetries, retryDelayMs,
    and retryOn are used by fetchWithRetry. Any other standard
    RequestInit properties (e.g., method, headers, body) are passed
    directly to fetch.

    Note: The signal property is omitted because it is used internally by
    the timeout mechanism. Do not provide your own signal when using
    fetchWithRetry.

    0.1.1

    interface FetchOptions {
        timeoutMs?: number;
        maxRetries?: number;
        retryDelayMs?: number;
        retryOn?: (response: Response) => boolean;
    }

    Hierarchy

    • Omit<RequestInit, "signal">
      • FetchOptions
    Index

    Properties

    timeoutMs?: number

    Request timeout in milliseconds.

    15000
    

    If the request takes longer than this duration, it will be aborted
    and retried (if retries remain). A timeout is considered a retryable error.

    maxRetries?: number

    Maximum number of retry attempts (excluding the initial attempt).

    3
    

    Total attempts = maxRetries + 1. The request will be retried up to
    this many times after the initial failure.

    retryDelayMs?: number

    Initial delay in milliseconds before the first retry.

    100
    

    Delay increases exponentially with each retry: retryDelayMs * 2^attempt.
    For example, with default values: 100ms, 200ms, 400ms.

    retryOn?: (response: Response) => boolean

    Predicate to decide if a failed response should be retried.

    Retries only on HTTP status >= 500 (server errors)
    

    The predicate receives the Response object and should return true
    if the request should be retried, false otherwise.

    // Retry on any non‑2xx status
    retryOn: (res) => !res.ok