Skip to content

HttpClient

Defined in: src/core/client.ts:62

static create(config): HttpClient

Defined in: src/core/client.ts:112

ClientConfig

HttpClient


use(middleware): this

Defined in: src/core/client.ts:121

MiddlewareFn

this


on<K>(event, listener): this

Defined in: src/core/client.ts:130

K extends keyof LifecycleEventMap

K

(data) => void

this


off<K>(event, listener): this

Defined in: src/core/client.ts:135

K extends keyof LifecycleEventMap

K

(data) => void

this


request<T>(url, options): Ticket<T>

Defined in: src/core/client.ts:148

Send a request. With parse, data is whatever parse returns; without it, data is the body read as responseType (BodyOf), or undefined with the body left unread on raw when that’s unset. When parse may or may not be set, data is T | undefined.

T

string

ParsedRequestOptions<T>

Ticket<T>

request<R>(url, options?): Ticket<BodyOf<R>>

Defined in: src/core/client.ts:149

Send a request. With parse, data is whatever parse returns; without it, data is the body read as responseType (BodyOf), or undefined with the body left unread on raw when that’s unset. When parse may or may not be set, data is T | undefined.

R extends ResponseType | undefined = undefined

string

UnparsedRequestOptions<R>

Ticket<BodyOf<R>>

request<T>(url, options?): Ticket<T | undefined>

Defined in: src/core/client.ts:153

Send a request. With parse, data is whatever parse returns; without it, data is the body read as responseType (BodyOf), or undefined with the body left unread on raw when that’s unset. When parse may or may not be set, data is T | undefined.

T

string

RequestOptions<T>

Ticket<T | undefined>


get<T>(url, options): Ticket<T>

Defined in: src/core/client.ts:922

GET request.

T

string

Omit<ParsedRequestOptions<T>, "method">

Ticket<T>

get<R>(url, options?): Ticket<BodyOf<R>>

Defined in: src/core/client.ts:923

GET request.

R extends ResponseType | undefined = undefined

string

Omit<UnparsedRequestOptions<R>, "method">

Ticket<BodyOf<R>>


head<T>(url, options): Ticket<T>

Defined in: src/core/client.ts:932

HEAD request.

T

string

Omit<ParsedRequestOptions<T>, "method">

Ticket<T>

head<R>(url, options?): Ticket<BodyOf<R>>

Defined in: src/core/client.ts:933

HEAD request.

R extends ResponseType | undefined = undefined

string

Omit<UnparsedRequestOptions<R>, "method">

Ticket<BodyOf<R>>


options<T>(url, options): Ticket<T>

Defined in: src/core/client.ts:942

OPTIONS request.

T

string

Omit<ParsedRequestOptions<T>, "method">

Ticket<T>

options<R>(url, options?): Ticket<BodyOf<R>>

Defined in: src/core/client.ts:943

OPTIONS request.

R extends ResponseType | undefined = undefined

string

Omit<UnparsedRequestOptions<R>, "method">

Ticket<BodyOf<R>>


post<T>(url, body, options): Ticket<T>

Defined in: src/core/client.ts:952

POST request.

T

string

BodyInit | (() => BodyInit) | undefined

Omit<ParsedRequestOptions<T>, "method" | "body">

Ticket<T>

post<R>(url, body?, options?): Ticket<BodyOf<R>>

Defined in: src/core/client.ts:957

POST request.

R extends ResponseType | undefined = undefined

string

BodyInit | (() => BodyInit)

Omit<UnparsedRequestOptions<R>, "method" | "body">

Ticket<BodyOf<R>>


put<T>(url, body, options): Ticket<T>

Defined in: src/core/client.ts:971

PUT request.

T

string

BodyInit | (() => BodyInit) | undefined

Omit<ParsedRequestOptions<T>, "method" | "body">

Ticket<T>

put<R>(url, body?, options?): Ticket<BodyOf<R>>

Defined in: src/core/client.ts:976

PUT request.

R extends ResponseType | undefined = undefined

string

BodyInit | (() => BodyInit)

Omit<UnparsedRequestOptions<R>, "method" | "body">

Ticket<BodyOf<R>>


patch<T>(url, body, options): Ticket<T>

Defined in: src/core/client.ts:990

PATCH request.

T

string

BodyInit | (() => BodyInit) | undefined

Omit<ParsedRequestOptions<T>, "method" | "body">

Ticket<T>

patch<R>(url, body?, options?): Ticket<BodyOf<R>>

Defined in: src/core/client.ts:995

PATCH request.

R extends ResponseType | undefined = undefined

string

BodyInit | (() => BodyInit)

Omit<UnparsedRequestOptions<R>, "method" | "body">

Ticket<BodyOf<R>>


delete<T>(url, options): Ticket<T>

Defined in: src/core/client.ts:1009

DELETE request.

T

string

Omit<ParsedRequestOptions<T>, "method">

Ticket<T>

delete<R>(url, options?): Ticket<BodyOf<R>>

Defined in: src/core/client.ts:1010

DELETE request.

R extends ResponseType | undefined = undefined

string

Omit<UnparsedRequestOptions<R>, "method">

Ticket<BodyOf<R>>


partitions(): BulkheadSnapshot[]

Defined in: src/core/client.ts:1025

Return a snapshot of all active bulkhead partitions. Each entry includes the partition name, running/queued counts, and configured concurrency/maxQueueSize limits.

BulkheadSnapshot[]


circuits(): CircuitSnapshot[]

Defined in: src/core/client.ts:1031

Return a snapshot of every partition’s circuit breaker that is enabled and has seen a request. Empty when no breaker is configured.

CircuitSnapshot[]


close(opts?): Promise<void>

Defined in: src/core/client.ts:1050

Close the client. New requests throw ConfigurationError("client closed"). When drain is true, in-flight tickets are awaited up to timeoutMs before the promise resolves, then remaining tickets are cancelled. When drain is false (default), all in-flight tickets are cancelled immediately.

timeoutMs is required when drain is true to prevent indefinite hangs — use a value that fits your shutdown budget. It must be a finite number in (0, 2_147_483_647] (the largest delay setTimeout honours, about 24.8 days); Infinity, NaN, zero, negatives and larger values reject with ConfigurationError and leave the client open.

CloseOptions

Promise<void>