Skip to content

Class: HttpTransport

Class: HttpTransport

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

HTTP transport port — one method per auth-server request. The default impl is fetch-backed (HttpTransport); tests can use InMemoryTransport.

Mirrors the PHP package’s Vendidit\AuthServer\Contracts\Transport.

Implementations:

  • HttpTransport (fetch-backed, the default)
  • InMemoryTransport (tests; canned responses)

A second, legacy port (HttpTransportPort) is exported for back-compat with AuthHttpClient / ServiceAuthClient — see below.

Implements

Constructors

Constructor

new HttpTransport(opts): HttpTransport

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

Parameters

opts

HttpTransportFetchOptions

Returns

HttpTransport

Methods

request()

request<T>(method, path, body?, headers?, accessToken?): Promise<T>

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

Send a JSON request. Returns the decoded body. Throws an appropriate VenAuthException subclass on non-2xx responses (status + envelope code → class via error-mapper) or NetworkException on transport failure.

Type Parameters

T

T = Record<string, unknown>

Parameters

method

string

path

string

body?

Record<string, unknown> | null

headers?

Record<string, string> = {}

accessToken?

string

Returns

Promise<T>

Implementation of

HttpTransportContract.request


redact()

static redact(payload): Record<string, unknown>

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

Visible-for-tests: redact sensitive keys before logging.

Parameters

payload

Record<string, unknown>

Returns

Record<string, unknown>