Logos DX
    Preparing search index...

    Interface CallConfig<H, P, S>

    Per-request configuration passed to HTTP methods (get, post, etc).

    Extends RequestConfig with per-request lifecycle hooks and abort controller.

    interface CallConfig<H = InstanceHeaders, P = InstanceParams, S = InstanceState> {
        abortController?: AbortController;
        attemptTimeout?: number;
        body?: BodyInit | null;
        cache?: RequestCache;
        credentials?: RequestCredentials;
        determineType?: DetermineTypeFn;
        headers?: DictAndT<H>;
        hooks?: {
            afterRequest?: (
                ...args: [
                    response: FetchResponse<
                        any,
                        FetchEngine.InstanceHeaders,
                        FetchEngine.InstanceParams,
                        FetchEngine.InstanceResponseHeaders,
                    >,
                    url: URL,
                    opts: InternalReqOptions<H, P, S>,
                    HookContext<
                        [
                            response: FetchResponse<
                                any,
                                FetchEngine.InstanceHeaders,
                                FetchEngine.InstanceParams,
                                FetchEngine.InstanceResponseHeaders,
                            >,
                            url: URL,
                            opts: InternalReqOptions<H, P, S>,
                        ],
                        FetchResponse<
                            any,
                            FetchEngine.InstanceHeaders,
                            FetchEngine.InstanceParams,
                            FetchEngine.InstanceResponseHeaders,
                        >,
                        [string],
                    >,
                ],
            ) => void | typeof EARLY_RETURN | Promise<void | typeof EARLY_RETURN>;
            beforeRequest?: (
                ...args: [
                    url: URL,
                    opts: InternalReqOptions<H, P, S>,
                    HookContext<
                        [url: URL, opts: InternalReqOptions<H, P, S>],
                        FetchResponse<
                            any,
                            FetchEngine.InstanceHeaders,
                            FetchEngine.InstanceParams,
                            FetchEngine.InstanceResponseHeaders,
                        >,
                        [string],
                    >,
                ],
            ) => void | typeof EARLY_RETURN | Promise<void | typeof EARLY_RETURN>;
        };
        integrity?: string;
        keepalive?: boolean;
        method?: string;
        mode?: RequestMode;
        onAfterReq?: (
            response: Response,
            opts: EngineRequestOpts<H, P>,
        ) => void | Promise<void>;
        onBeforeReq?: (opts: EngineRequestOpts<H, P>) => void | Promise<void>;
        onError?: (err: FetchError<any, any>) => void | Promise<void>;
        params?: DictAndT<P>;
        priority?: RequestPriority;
        redirect?: RequestRedirect;
        referrer?: string;
        referrerPolicy?: ReferrerPolicy;
        requestId?: string;
        retry?: boolean | RetryConfig;
        signal?: AbortSignal;
        timeout?: number;
        totalTimeout?: number;
        window?: null;
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Properties

    abortController?: AbortController

    AbortController for manual request cancellation

    attemptTimeout?: number

    Per-attempt timeout (ms) - each retry gets fresh timeout

    body?: BodyInit | null

    A BodyInit object or null to set request's body.

    cache?: RequestCache

    A string indicating how the request will interact with the browser's cache to set request's cache.

    credentials?: RequestCredentials

    A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials.

    determineType?: DetermineTypeFn

    Function to determine response body type based on response

    headers?: DictAndT<H>

    Request headers (merged with instance defaults)

    hooks?: {
        afterRequest?: (
            ...args: [
                response: FetchResponse<
                    any,
                    FetchEngine.InstanceHeaders,
                    FetchEngine.InstanceParams,
                    FetchEngine.InstanceResponseHeaders,
                >,
                url: URL,
                opts: InternalReqOptions<H, P, S>,
                HookContext<
                    [
                        response: FetchResponse<
                            any,
                            FetchEngine.InstanceHeaders,
                            FetchEngine.InstanceParams,
                            FetchEngine.InstanceResponseHeaders,
                        >,
                        url: URL,
                        opts: InternalReqOptions<H, P, S>,
                    ],
                    FetchResponse<
                        any,
                        FetchEngine.InstanceHeaders,
                        FetchEngine.InstanceParams,
                        FetchEngine.InstanceResponseHeaders,
                    >,
                    [string],
                >,
            ],
        ) => void | typeof EARLY_RETURN | Promise<void | typeof EARLY_RETURN>;
        beforeRequest?: (
            ...args: [
                url: URL,
                opts: InternalReqOptions<H, P, S>,
                HookContext<
                    [url: URL, opts: InternalReqOptions<H, P, S>],
                    FetchResponse<
                        any,
                        FetchEngine.InstanceHeaders,
                        FetchEngine.InstanceParams,
                        FetchEngine.InstanceResponseHeaders,
                    >,
                    [string],
                >,
            ],
        ) => void | typeof EARLY_RETURN | Promise<void | typeof EARLY_RETURN>;
    }

    Per-request hooks appended after all engine-level hooks.

    These run at the end of the hook chain for this single request only.

    integrity?: string

    A cryptographic hash of the resource to be fetched by request. Sets request's integrity.

    keepalive?: boolean

    A boolean to set request's keepalive.

    method?: string

    A string to set request's method.

    A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode.

    onAfterReq?: (
        response: Response,
        opts: EngineRequestOpts<H, P>,
    ) => void | Promise<void>
    onBeforeReq?: (opts: EngineRequestOpts<H, P>) => void | Promise<void>
    onError?: (err: FetchError<any, any>) => void | Promise<void>
    params?: DictAndT<P>

    URL parameters (merged with instance defaults)

    priority?: RequestPriority
    redirect?: RequestRedirect

    A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect.

    referrer?: string

    A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer.

    referrerPolicy?: ReferrerPolicy

    A referrer policy to set request's referrerPolicy.

    requestId?: string

    Override the auto-generated request ID for this request.

    When provided, this value is used instead of generateRequestId() or the default generateId(). Useful for propagating an external trace ID from an upstream service or user-defined correlation ID.

    await api.get('/orders', {
    requestId: incomingTraceId
    });
    retry?: boolean | RetryConfig

    Retry configuration

    signal?: AbortSignal

    AbortSignal for request cancellation

    timeout?: number

    Use totalTimeout instead

    totalTimeout?: number

    Total timeout for entire request lifecycle including retries (ms)

    window?: null

    Can only be null. Used to disassociate request from any Window.