MCPcopy Index your code
hub / github.com/simstudioai/sim / readAgentMailBody

Function readAgentMailBody

apps/sim/app/api/webhooks/agentmail/route.ts:46–53  ·  view source on GitHub ↗

* Bound the unauthenticated AgentMail webhook body before buffering it for Svix * signature verification, so an oversized payload cannot exhaust pod memory.

(req: Request)

Source from the content-addressed store, hash-verified

44 * signature verification, so an oversized payload cannot exhaust pod memory.
45 */
46async function readAgentMailBody(req: Request): Promise<string> {
47 assertContentLengthWithinLimit(req.headers, WEBHOOK_MAX_BODY_BYTES, AGENTMAIL_BODY_LABEL)
48 const buffer = await readStreamToBufferWithLimit(req.body, {
49 maxBytes: WEBHOOK_MAX_BODY_BYTES,
50 label: AGENTMAIL_BODY_LABEL,
51 })
52 return new TextDecoder().decode(buffer)
53}
54
55export const POST = withRouteHandler(async (req: Request) => {
56 try {

Callers 1

route.tsFile · 0.85

Calls 2

Tested by

no test coverage detected