Skip to content

Fault

Fault = { status: number; retryAfter?: number | string; body?: string; headers?: HeadersInit; } | { latencyMs: number; } | { networkError: true; } | { hang: true; }

Defined in: src/testing/index.ts:5

One thing faultyFetch can do to a call. Exactly one shape per fault.

{ status: number; retryAfter?: number | string; body?: string; headers?: HeadersInit; }

Answer with this status without calling the inner fetch.


{ latencyMs: number; }

Wait latencyMs, then call the inner fetch as usual.


{ networkError: true; }

Reject with a TypeError, like fetch does when the network fails.


{ hang: true; }

Never settle, until the request’s signal aborts.