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

Function writeJson

packages/plugins/mcp/src/testing/server.ts:43–54  ·  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

41}> {}
42
43const writeJson = (
44 response: http.ServerResponse,
45 status: number,
46 body: Readonly<Record<string, unknown>>,
47 headers: Readonly<Record<string, string>> = {},
48) => {
49 response.writeHead(status, {
50 "content-type": "application/json",
51 ...headers,
52 });
53 response.end(JSON.stringify(body));
54};
55
56const writeText = (response: http.ServerResponse, status: number, body: string) => {
57 response.writeHead(status, { "content-type": "text/plain; charset=utf-8" });

Callers 1

handleMcpRequestFunction · 0.70

Calls 1

endMethod · 0.80

Tested by

no test coverage detected