Documentation
    Preparing search index...

    Fetch API request options.

    Subset of the standard RequestInit interface, excluding properties that are managed internally (body, headers, method). These options control caching, CORS, credentials, and request lifecycle behavior.

    interface IOptions {
        cache?:
            | "default"
            | "force-cache"
            | "no-cache"
            | "no-store"
            | "only-if-cached"
            | "reload";
        credentials?: "omit"
        | "same-origin"
        | "include";
        integrity?: string;
        keepalive?: boolean;
        mode?: "same-origin" | "cors" | "navigate" | "no-cors";
        redirect?: "error" | "follow" | "manual";
        referrer?: string;
        referrerPolicy?:
            | ""
            | "same-origin"
            | "no-referrer"
            | "no-referrer-when-downgrade"
            | "origin"
            | "origin-when-cross-origin"
            | "strict-origin"
            | "strict-origin-when-cross-origin"
            | "unsafe-url";
        signal?: AbortSignal
        | null;
    }
    Index

    Properties

    cache?:
        | "default"
        | "force-cache"
        | "no-cache"
        | "no-store"
        | "only-if-cached"
        | "reload"

    Request cache mode.

    Controls how the request interacts with the browser's HTTP cache.

    • "default": Standard browser caching behavior
    • "no-store": Bypass cache completely, don't store response
    • "reload": Bypass cache, but store response
    • "no-cache": Validate with server before using cache
    • "force-cache": Use cache even if stale
    • "only-if-cached": Only use cache, fail if not cached
    credentials?: "omit" | "same-origin" | "include"

    Credentials inclusion mode.

    Controls whether cookies and HTTP authentication are sent.

    • "omit": Never send credentials
    • "same-origin": Send credentials only for same-origin requests
    • "include": Always send credentials, even cross-origin
    integrity?: string

    Subresource integrity hash for verification.

    A cryptographic hash (e.g., "sha256-abc123...") to verify the fetched resource hasn't been tampered with. The browser will reject responses that don't match the expected hash.

    keepalive?: boolean

    Whether to keep the connection alive after page unload.

    When true, the request can outlive the page that initiated it. Useful for analytics or logging requests that should complete even if the user navigates away.

    mode?: "same-origin" | "cors" | "navigate" | "no-cors"

    CORS (Cross-Origin Resource Sharing) mode.

    Controls cross-origin request behavior.

    • "cors": Standard CORS request (requires server support)
    • "no-cors": Limited cross-origin request (opaque response)
    • "same-origin": Only allow same-origin requests
    • "navigate": For navigation requests (used by browsers)
    redirect?: "error" | "follow" | "manual"

    HTTP redirect handling behavior.

    • "follow": Automatically follow redirects (default)
    • "error": Throw an error on redirect
    • "manual": Return redirect response for manual handling
    referrer?: string

    Referrer URL to send with the request.

    Overrides the default referrer. Use empty string to suppress the referrer header entirely.

    referrerPolicy?:
        | ""
        | "same-origin"
        | "no-referrer"
        | "no-referrer-when-downgrade"
        | "origin"
        | "origin-when-cross-origin"
        | "strict-origin"
        | "strict-origin-when-cross-origin"
        | "unsafe-url"

    Policy for how much referrer information to include.

    Controls what referrer information is sent with requests. More restrictive policies improve privacy but may break some server-side analytics or security checks.

    signal?: AbortSignal | null

    AbortSignal for request cancellation.

    Connect to an AbortController to enable cancellation of in-flight requests. When the signal is aborted, the fetch promise rejects with an AbortError.

    const controller = new AbortController();
    const options = { signal: controller.signal };
    // Later: controller.abort();