MCPcopy Create free account
hub / github.com/TanStack/ai / handleRequest

Function handleRequest

testing/e2e/global-setup.ts:142–156  ·  view source on GitHub ↗
(
      req: http.IncomingMessage,
      res: http.ServerResponse,
      // aimock strips the mount prefix — pathname will be "/" for an exact match.
      pathname: string,
    )

Source from the content-addressed store, hash-verified

140function grokTTSMount(): Mountable {
141 return {
142 async handleRequest(
143 req: http.IncomingMessage,
144 res: http.ServerResponse,
145 // aimock strips the mount prefix — pathname will be "/" for an exact match.
146 pathname: string,
147 ): Promise<boolean> {
148 if (pathname !== '/' || req.method !== 'POST') return false
149 // Drain the request body (we don't need to inspect it for tests).
150 await drainBody(req)
151 res.statusCode = 200
152 res.setHeader('Content-Type', 'audio/mpeg')
153 res.setHeader('Content-Length', String(FAKE_MP3_BYTES.length))
154 res.end(FAKE_MP3_BYTES)
155 return true
156 },
157 }
158}
159

Callers

nothing calls this directly

Calls 7

drainBodyFunction · 0.85
buildFollowUpEventsFunction · 0.85
parseMethod · 0.80
writeMethod · 0.80
readBodyFunction · 0.70
endMethod · 0.65

Tested by

no test coverage detected