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.
Union Members
Section titled “Union Members”Type Literal
Section titled “Type Literal”{ status: number; retryAfter?: number | string; body?: string; headers?: HeadersInit; }
Answer with this status without calling the inner fetch.
Type Literal
Section titled “Type Literal”{ latencyMs: number; }
Wait latencyMs, then call the inner fetch as usual.
Type Literal
Section titled “Type Literal”{ networkError: true; }
Reject with a TypeError, like fetch does when the network fails.
Type Literal
Section titled “Type Literal”{ hang: true; }
Never settle, until the request’s signal aborts.
