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

Function writeJson

packages/plugins/mcp/src/testing/server.ts:51–62  ·  view source on GitHub ↗
(
  response: http.ServerResponse,
  status: number,
  body: Readonly<Record<string, unknown>>,
  headers: Readonly<Record<string, string>> = {},
)

Source from the content-addressed store, hash-verified

49}> {}
50
51const writeJson = (
52 response: http.ServerResponse,
53 status: number,
54 body: Readonly<Record<string, unknown>>,
55 headers: Readonly<Record<string, string>> = {},
56) => {
57 response.writeHead(status, {
58 "content-type": "application/json",
59 ...headers,
60 });
61 response.end(JSON.stringify(body));
62};
63
64const writeText = (response: http.ServerResponse, status: number, body: string) => {
65 response.writeHead(status, { "content-type": "text/plain; charset=utf-8" });

Callers 2

writeUnauthorizedFunction · 0.70
handleMcpRequestFunction · 0.70

Calls 1

endMethod · 0.80

Tested by

no test coverage detected