Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HaxanFactory<T>

Request factory, supports both options (given in constructor) and a chainable API

Type parameters

  • T = unknown

Hierarchy

  • HaxanFactory

Index

Constructors

constructor

  • new HaxanFactory<T>(url: string, _fetch?: () => (input: RequestInfo, init?: RequestInit) => Promise<Response>, opts?: Partial<Omit<IHaxanOptions, "url">>): HaxanFactory<T>
  • Type parameters

    • T = unknown

    Parameters

    • url: string
    • Optional _fetch: () => (input: RequestInfo, init?: RequestInit) => Promise<Response>
        • (): (input: RequestInfo, init?: RequestInit) => Promise<Response>
        • Returns (input: RequestInfo, init?: RequestInit) => Promise<Response>

            • (input: RequestInfo, init?: RequestInit): Promise<Response>
            • Parameters

              • input: RequestInfo
              • Optional init: RequestInit

              Returns Promise<Response>

    • Optional opts: Partial<Omit<IHaxanOptions, "url">>

    Returns HaxanFactory<T>

Properties

Private _addOptions

_addOptions: Record<string, unknown> = {}

Private _fetch

_fetch: () => (input: RequestInfo, init?: RequestInit) => Promise<Response>

Type declaration

    • (): (input: RequestInfo, init?: RequestInit) => Promise<Response>
    • Returns (input: RequestInfo, init?: RequestInit) => Promise<Response>

        • (input: RequestInfo, init?: RequestInit): Promise<Response>
        • Parameters

          • input: RequestInfo
          • Optional init: RequestInit

          Returns Promise<Response>

Private _opts

_opts: IHaxanOptions = ...

Methods

abort

addOptions

body

Private buildUrl

  • buildUrl(): string

delete

Private doRequest

execute

get

getOptions

head

header

method

Private normalizedBody

  • normalizedBody(): null | string

options

param

Private parseBody

  • parseBody(res: Response): Promise<T>

Private parseResponse

patch

post

put

redirect

request

send

Private setProp

timeout

type

url

Generated using TypeDoc