Member Junction
    Preparing search index...

    Everything HttpRequest accepts. Only Url is required.

    When used through HttpClient, each field falls back to the client's corresponding option, except Headers, which is merged over the client's defaults key-by-key.

    await HttpRequest({
    Url: '/reports',
    BaseURL: 'https://api.example.com/v2',
    Method: 'POST',
    Query: { format: 'json', tag: ['a', 'b'] }, // -> ?format=json&tag=a&tag=b
    Body: { name: 'Q3' }, // JSON-encoded automatically
    Timeout: 15000,
    ValidateUrl: false,
    });
    interface HttpRequestConfig {
        BaseURL?: string;
        BasicAuth?: { Password: string; Username: string };
        Body?: unknown;
        Headers?: Record<string, string>;
        MaxRedirects?: number;
        Method?: HttpMethod;
        Query?: Record<string, HttpQueryValue>;
        ResponseType?: HttpResponseType;
        Signal?: AbortSignal;
        ThrowOnError?: boolean;
        Timeout?: number;
        Url: string;
        ValidateUrl?: boolean;
    }
    Index

    Properties

    BaseURL?: string

    Prefix applied to a relative Url.

    BasicAuth?: { Password: string; Username: string }

    HTTP Basic credentials. Encoded into an Authorization: Basic ... header — the replacement for axios's auth option. An explicit Authorization header takes precedence.

    Body?: unknown

    Request body. A plain object or array is JSON-encoded (with a Content-Type: application/json default); string, URLSearchParams, FormData, Blob, ArrayBuffer, and typed arrays are passed through to fetch untouched so it can set the right Content-Type itself.

    Headers?: Record<string, string>

    Request headers. Merged over any client-level defaults.

    MaxRedirects?: number

    Maximum redirect hops to follow. Default: 5.

    With ValidateUrl off, 0 returns the 3xx response itself rather than following it. With ValidateUrl on, SafeFetch drives redirects manually, so 0 makes a redirected request throw once the cap is hit rather than returning the 3xx.

    Method?: HttpMethod

    HTTP method. Default: GET.

    Query?: Record<string, HttpQueryValue>

    Query-string parameters appended to the URL.

    ResponseType?: HttpResponseType

    How to interpret the response body. Default: json.

    Signal?: AbortSignal

    Caller-supplied abort signal, honored alongside Timeout.

    ThrowOnError?: boolean

    When true (default), a non-2xx status throws HttpError instead of returning.

    Timeout?: number

    Request timeout in milliseconds. Default: 30000. Pass 0 to disable.

    Url: string

    Target URL. Resolved against BaseURL when that is set and this is relative.

    ValidateUrl?: boolean

    When true, run the URL through the SSRF guard (and re-check every redirect hop). Default: false.