Core
withHTTPHandle
Replaces the Fetch-compatible function used for HTTP requests.
@defjs/core · Function
Signature
function withHTTPHandle(fetchImpl: FetchHandle): ClientOption;
The default is the platform fetch. fetchImpl is a FetchHandle, so a test double does not need host extras such as fetch.preconnect. It only affects HTTP. SSE uses withSSEHandle.
Parameters
Prop
Type
fetchImpl FetchHandle(input, init?) => Promise<Response>. Not typeof fetch, so
a mock does not need host extras such as preconnect.
Returns
An option that sets config.http.handle.