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

Function stubFetch

packages/react/src/api/tracing.test.ts:9–13  ·  view source on GitHub ↗
(onRequest: (request: Request) => void)

Source from the content-addressed store, hash-verified

7/** `Fetch` is a Context.Reference defaulting to `globalThis.fetch`, so a stub
8 * layer overrides it without discharging any requirement. */
9const stubFetch = (onRequest: (request: Request) => void): Layer.Layer<never> =>
10 Layer.succeed(FetchHttpClient.Fetch)(((input: RequestInfo | URL, init?: RequestInit) => {
11 onRequest(input instanceof Request ? input : new Request(String(input), init));
12 return Promise.resolve(new Response(null, { status: 200 }));
13 }) as typeof globalThis.fetch);
14
15// The browser client exports its spans itself — no cloud span processor runs
16// in the page — so the scrub is asserted on the serialized OTLP payload the

Callers 1

tracing.test.tsFile · 0.70

Calls 2

onRequestFunction · 0.85
resolveMethod · 0.80

Tested by

no test coverage detected