MCPcopy Create free account
hub / github.com/dwgx/WindsurfAPI / json

Function json

src/server.js:115–129  ·  view source on GitHub ↗
(res, status, body)

Source from the content-addressed store, hash-verified

113}
114
115function json(res, status, body) {
116 const data = JSON.stringify(body);
117 res.writeHead(status, {
118 'Content-Type': 'application/json',
119 'Access-Control-Allow-Origin': '*',
120 'Access-Control-Allow-Methods': 'GET, POST, DELETE, OPTIONS',
121 'Access-Control-Allow-Headers': 'Content-Type, Authorization',
122 // Per-request dynamic responses must not be cached by intermediaries.
123 // Some upstream aggregators (e.g. sub2api, #97) priority-cache responses
124 // when they don't see an explicit Cache-Control directive and serve
125 // stale content for fresh requests.
126 'Cache-Control': 'no-store',
127 });
128 res.end(data);
129}
130
131async function route(req, res) {
132 const { method } = req;

Callers 3

sendBodyTooLargeIfNeededFunction · 0.70
routeFunction · 0.70
startServerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected