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

Function serveSpec

e2e/selfhost/detected-auth-immutable-ui.test.ts:77–99  ·  view source on GitHub ↗
(body: string)

Source from the content-addressed store, hash-verified

75
76/** A real 127.0.0.1 server that serves a static OpenAPI spec for the add flow. */
77const serveSpec = (body: string) =>
78 Effect.acquireRelease(
79 Effect.callback<{ readonly url: string; readonly close: () => void }>((resume) => {
80 const server = createServer((_request, response) => {
81 response.writeHead(200, { "content-type": "application/json" });
82 response.end(body);
83 });
84 server.listen(0, "127.0.0.1", () => {
85 const address = server.address();
86 const port = typeof address === "object" && address ? address.port : 0;
87 resume(
88 Effect.succeed({
89 url: `http://127.0.0.1:${port}/spec.json`,
90 close: () => {
91 server.close();
92 server.closeAllConnections();
93 },
94 }),
95 );
96 });
97 }),
98 (server) => Effect.sync(server.close),
99 );
100
101const apiKeyAndOAuthSpec = (): string =>
102 JSON.stringify({

Calls 6

resumeFunction · 0.85
endMethod · 0.80
listenMethod · 0.80
addressMethod · 0.80
closeMethod · 0.65
syncMethod · 0.65

Tested by

no test coverage detected