MCPcopy
hub / github.com/simstudioai/sim / readRequestBody

Function readRequestBody

apps/realtime/src/routes/http.ts:33–42  ·  view source on GitHub ↗
(req: IncomingMessage)

Source from the content-addressed store, hash-verified

31}
32
33function readRequestBody(req: IncomingMessage): Promise<string> {
34 return new Promise((resolve, reject) => {
35 let body = ''
36 req.on('data', (chunk) => {
37 body += chunk.toString()
38 })
39 req.on('end', () => resolve(body))
40 req.on('error', reject)
41 })
42}
43
44function sendSuccess(res: ServerResponse): void {
45 res.writeHead(200, { 'Content-Type': 'application/json' })

Callers 1

createHttpHandlerFunction · 0.85

Calls 3

onMethod · 0.80
resolveFunction · 0.50
toStringMethod · 0.45

Tested by

no test coverage detected