kinetex - v1.0.0-rc.1
    Preparing search index...

    Class FluentRequest

    Fluent (chained) request builder. Each method returns this for chaining; call .send() or a parser method to execute.

    const data = await client
    .GET("/users")
    .header("x-api-version", "2")
    .param("page", 1)
    .timeout(5000)
    .retry(2)
    .json<User[]>();
    Index

    Constructors

    Methods

    • Set or override a single header.

      Parameters

      • name: string
      • value: string

      Returns this

    • Set a JSON body (serializes and sets Content-Type).

      Parameters

      • data: unknown

      Returns this

    • Set a FormData body.

      Parameters

      • data: FormData

      Returns this

    • Set Bearer token authentication.

      Parameters

      • token: string | (() => string | Promise<string>)

      Returns this

    • Set Basic authentication.

      Parameters

      • username: string
      • password: string

      Returns this

    • Set API key authentication.

      Parameters

      • header: string
      • key: string

      Returns this

    • Set Digest Access Authentication (RFC 7616).

      Parameters

      • username: string
      • password: string

      Returns this

    • Set request timeout in ms.

      Parameters

      • ms: number

      Returns this

    • Force a fresh fetch, bypassing any cached response.

      Returns this

    • Attach an AbortSignal for cancellation.

      Parameters

      • signal: AbortSignal

      Returns this

    • Set maximum response body size in bytes.

      Parameters

      • bytes: number

      Returns this

    • Do not throw on 4xx/5xx status codes.

      Returns this

    • Attach cache tags.

      Parameters

      • ...tags: string[]

      Returns this

    • Attach arbitrary metadata.

      Parameters

      • data: Record<string, unknown>

      Returns this

    • Execute and return the parsed data. Alias for .send().then(r => r.data).

      Type Parameters

      • T = unknown

      Returns Promise<T>

    • Execute, parse as JSON, and return the typed data.

      Type Parameters

      • T = unknown

      Returns Promise<T>

    • Execute, parse as text, and return the string.

      Returns Promise<string>

    • Execute, return raw bytes.

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • Execute, return a Blob.

      Returns Promise<Blob>