MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / installFetch

Function installFetch

apps/cli/src/device-login.test.ts:24–30  ·  view source on GitHub ↗
(handler: (url: string, init: RequestInit | undefined) => Response)

Source from the content-addressed store, hash-verified

22 });
23
24const installFetch = (handler: (url: string, init: RequestInit | undefined) => Response) => {
25 globalThis.fetch = ((input: RequestInfo | URL, init?: RequestInit) => {
26 const url =
27 typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
28 return Promise.resolve(handler(url, init));
29 }) as typeof fetch;
30};
31
32const recordCall = (calls: Array<FetchCall>, url: string, init: RequestInit | undefined): void => {
33 calls.push({

Callers 1

Calls 3

toStringMethod · 0.80
resolveMethod · 0.80
handlerFunction · 0.50

Tested by

no test coverage detected