FuncType - v1.4.1
    Preparing search index...

    Interface HttpRequestOptions<T>

    interface HttpRequestOptions<T = unknown> {
        body?: unknown;
        decode?: Decoder<T>;
        flatten?: boolean;
        headers?: Record<string, string>;
        method: HttpMethod;
        params?: Readonly<
            Record<
                string,
                | string
                | number
                | boolean
                | readonly (string | number | boolean)[]
                | null
                | undefined,
            >,
        >;
        parseAs?: ParseMode;
        signal?: AbortSignal;
        url: string;
        validate?: (data: unknown) => T;
    }

    Type Parameters

    • T = unknown
    Index

    Properties

    body?: unknown
    decode?: Decoder<T>

    Either-returning response decoder. Returns Left(DecoderError) on failure; the framework maps that to HttpError.DecodeError(cause: DecoderError). The recursive DecoderError tree preserves structural failure info (paths, child errors) for diagnosis and rendering.

    For adapters whose primary API throws (e.g. Zod's .parse), use an adapter package (e.g. functype-zod's Decoder.fromZod(schema)) or wrap the throwing function in a tiny custom decoder. The deprecated validate field is also still accepted for back-compat.

    flatten?: boolean

    Whether to flatten functype ADTs in the request body to their primitive projections (Option → nullable, Either → right-value-or-throw-on-Left, List → array, Try → success-value-or-throw, Map → record) before serializing. Default true — matches the wire shape external JSON APIs expect.

    Set to false to emit each ADT's canonical {_tag, value} form via toValue() for functype-to-functype services where both ends round-trip the tagged shape via Decoder.tagged.*.

    headers?: Record<string, string>
    method: HttpMethod
    params?: Readonly<
        Record<
            string,
            | string
            | number
            | boolean
            | readonly (string | number | boolean)[]
            | null
            | undefined,
        >,
    >

    Query-string parameters appended to the URL. Merges with any query string already present in url. See HttpQueryParams for encoding rules.

    parseAs?: ParseMode
    signal?: AbortSignal
    url: string
    validate?: (data: unknown) => T

    Use decode (Either-returning). For throw-pattern adapters like Zod's .parse, prefer an adapter package (functype-zod's Decoder.fromZod). validate is kept for back-compat with the 1.0.x API and will be removed in a future major release. Throwing maps to HttpError.DecodeError(cause: Error).