Fetch Client API Documentation - v1.1.1
    Preparing search index...

    Interface RetryConfig

    Configuration for retry behavior when requests fail

    Controls how failed requests should be retried with exponential backoff

    // Simple retry with default settings
    const simpleRetry: RetryConfig = { maxRetries: 3 };

    // Advanced retry configuration
    const advancedRetry: RetryConfig = {
    maxRetries: 5,
    delay: 2000,
    shouldRetry: [408, 429, 500, 502, 503, 504]
    };

    // Custom retry logic
    const customRetry: RetryConfig = {
    maxRetries: 3,
    shouldRetry: (error) => error instanceof Error && error.name === 'NetworkError'
    };
    interface RetryConfig {
        maxRetries: number;
        delay?: number;
        shouldRetry?: readonly number[] | ((error: Error | Response) => boolean);
    }
    Index

    Properties

    maxRetries: number

    Maximum number of retry attempts before giving up

    3 // Will try original request + 3 retries = 4 total attempts
    
    delay?: number

    Base delay between retries in milliseconds (default: 1000)

    Uses exponential backoff: delay * 2^attempt + jitter

    1000 // First retry after 1s, second after ~2s, third after ~4s
    
    shouldRetry?: readonly number[] | ((error: Error | Response) => boolean)

    HTTP status codes to retry on, or custom retry function

    Array of status codes or function to determine if request should be retried

    [408, 429, 500, 502, 503, 504] // Retry on timeout and server errors
    
    (error) => error.status >= 500 // Retry only on server errors