Core
FetchHandle
Fetch-compatible function used as an HTTP or SSE handle.
@defjs/core · Type
Signature
type FetchHandle = ( input: RequestInfo | URL, init?: RequestInit, ) => Promise<Response>;
This is the (input, init?) => Promise<Response> call signature Defjs invokes, deliberately not typeof fetch, so a mock does not need host extras such as preconnect. HTTP calls the untouched platform Fetch as (url, init); a replaced global Fetch or custom handle receives a Request. The default resolves the global on each call. SSE always passes a Request, including to its default handle.
Accepted by withHTTPHandle, withSSEHandle, and fetchHandler.
Parameters
Prop
Type
input URL | RequestInfoinit? RequestInit