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

Function writeJson

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

52}> {}
53
54const writeJson = (
55 response: http.ServerResponse,
56 status: number,
57 body: Readonly<Record<string, unknown>>,
58 headers: Readonly<Record<string, string>> = {},
59) => {
60 response.writeHead(status, {
61 "content-type": "application/json",
62 ...headers,
63 });
64 response.end(JSON.stringify(body));
65};
66
67const writeText = (response: http.ServerResponse, status: number, body: string) => {
68 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