Skip to content

Interface: HttpTransportFetchOptions

Interface: HttpTransportFetchOptions

Defined in: auth-server-ts/src/http/http-transport.ts:29

Default HttpTransport implementation — fetch-based.

Responsibilities:

  • Build absolute URLs from ResolvedConfig + path.
  • JSON-encode bodies + decode responses (with Content-Type shaping for the OAuth client-credentials form-urlencoded edge case).
  • Auto-attach the bearer token when an access token is passed in.
  • Inject Idempotency-Key on unsafe methods so safe retries hit the auth-server’s idempotency middleware idempotently.
  • Forward X-App-Code from config.
  • Map non-2xx via ErrorMapper; map network failure to NetworkException.

Picked fetch (not axios) because it’s universally available — Node 20+, Bun, Deno, edge runtimes, the browser — and removes a runtime dep from the core. Framework adapters can bring their own client (the NestJS adapter ships AxiosHttpTransportAdapter that satisfies the legacy HttpTransportPort).

Mirrors PHP’s Vendidit\AuthServer\Http\HttpTransport.

Properties

config

config: ResolvedConfig

Defined in: auth-server-ts/src/http/http-transport.ts:30


fetch?

optional fetch?: {(input, init?): Promise<Response>; (input, init?): Promise<Response>; }

Defined in: auth-server-ts/src/http/http-transport.ts:32

Inject a custom fetch (e.g. with retry/circuit-breaker). Defaults to global fetch.

Call Signature

(input, init?): Promise<Response>

MDN Reference

Parameters
input

RequestInfo | URL

init?

RequestInit

Returns

Promise<Response>

Call Signature

(input, init?): Promise<Response>

MDN Reference

Parameters
input

string | Request | URL

init?

RequestInit

Returns

Promise<Response>


logger?

optional logger?: LoggerPort

Defined in: auth-server-ts/src/http/http-transport.ts:33