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

    Interface RequestConfig

    Configuration for individual HTTP requests

    Extends native RequestInit with additional API client features

    const config: RequestConfig = {
    method: 'POST',
    url: '/api/users',
    baseURL: 'https://api.example.com',
    data: { name: 'John', email: 'john@example.com' },
    headers: { 'Authorization': 'Bearer token123' },
    timeout: 10000,
    retry: { maxRetries: 3, delay: 1000 },
    params: { include: 'profile', format: 'json' }
    };
    interface RequestConfig {
        baseURL?: string;
        timeout?: number;
        method: HttpMethod;
        params?: Record<string, string | number | boolean>;
        url: string;
        responseType?: ResponseType;
        data?: Body;
        retry?: number | RetryConfig;
    }

    Hierarchy

    • Omit<RequestInit, "body" | "method">
      • RequestConfig
    Index

    Properties

    baseURL?: string

    Base URL for the request - will be combined with url

    'https://api.example.com'
    
    timeout?: number

    Request timeout in milliseconds before aborting

    10000 // 10 second timeout
    
    method: HttpMethod

    HTTP method for the request

    'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'
    
    params?: Record<string, string | number | boolean>

    Query parameters to append to URL

    Automatically URL-encoded and appended as query string

    { page: 1, limit: 10 } // Results in ?page=1&limit=10
    
    url: string

    Request URL path (relative to baseURL if provided)

    '/api/users' or 'https://api.example.com/users'
    
    responseType?: ResponseType

    Expected response type for automatic parsing

    'json' | 'text' | 'blob' | 'arrayBuffer' | 'auto'
    
    data?: Body

    Request body data (will be automatically serialized)

    { name: 'John' } // JSON object
    
    'raw text' // Plain string
    
    new FormData() // Form data
    
    retry?: number | RetryConfig

    Retry configuration for failed requests

    3 // Simple: retry 3 times with defaults
    
    { maxRetries: 5, delay: 2000 } // Advanced configuration