Skip to content

Class: InMemoryTransport

Class: InMemoryTransport

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

In-memory transport for tests. Pre-loaded with canned responses keyed by “METHOD path”. Records every call so tests can assert against them.

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

Implements

Constructors

Constructor

new InMemoryTransport(): InMemoryTransport

Returns

InMemoryTransport

Properties

calls

readonly calls: RecordedCall[] = []

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

Methods

on()

on(method, path, response): void

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

Queue a successful response for METHOD + path.

Parameters

method

string

path

string

response

Record<string, unknown>

Returns

void


onError()

onError(method, path, error): void

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

Queue an error to throw on the next match for METHOD + path.

Parameters

method

string

path

string

error

VenAuthException

Returns

void


request()

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

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

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