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

Function captureRequest

packages/plugins/graphql/src/testing/index.ts:100–115  ·  view source on GitHub ↗
(
  initial: YogaInitialContext,
  requests: Ref.Ref<readonly GraphqlTestRequest[]>,
)

Source from the content-addressed store, hash-verified

98});
99
100const captureRequest = (
101 initial: YogaInitialContext,
102 requests: Ref.Ref<readonly GraphqlTestRequest[]>,
103) => {
104 const url = new URL(initial.request.url);
105 const captured: GraphqlTestRequest = {
106 url: initial.request.url,
107 method: initial.request.method,
108 path: url.pathname,
109 headers: headersFromRequest(initial.request.headers),
110 payload: payloadFromParams(initial.params),
111 };
112 return Effect.runPromise(
113 Ref.update(requests, (all) => [...all, captured]).pipe(Effect.as(captured)),
114 );
115};
116
117export const serveGraphqlTestServer = (
118 options: GraphqlTestServerOptions,

Callers 1

serveGraphqlTestServerFunction · 0.85

Calls 3

headersFromRequestFunction · 0.85
payloadFromParamsFunction · 0.85
updateMethod · 0.65

Tested by

no test coverage detected