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

Function clientLayer

apps/host-selfhost/src/testing/mint-invite.ts:29–40  ·  view source on GitHub ↗
(handler: Handler, token: string)

Source from the content-addressed store, hash-verified

27
28// A FetchHttpClient backed by the in-process handler, carrying the admin bearer.
29const clientLayer = (handler: Handler, token: string) =>
30 FetchHttpClient.layer.pipe(
31 Layer.provide(
32 Layer.succeed(FetchHttpClient.Fetch)(((input: RequestInfo | URL, init?: RequestInit) => {
33 const base = input instanceof Request ? input : new Request(input, init);
34 const request = new Request(base, {
35 headers: { ...Object.fromEntries(base.headers), authorization: `Bearer ${token}` },
36 });
37 return handler(request);
38 }) as typeof globalThis.fetch),
39 ),
40 );
41
42export const mintInviteCode = async (
43 handler: Handler,

Callers 1

mintInviteCodeFunction · 0.85

Calls 1

handlerFunction · 0.50

Tested by

no test coverage detected