MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / safeParseBody

Function safeParseBody

packages/integration-kit/src/webhooks.ts:7–17  ·  view source on GitHub ↗
(body: any)

Source from the content-addressed store, hash-verified

5
6// If it's a Buffer, it will be parsed as JSON
7export function safeParseBody(body: any) {
8 if (Buffer.isBuffer(body)) {
9 return safeJsonParse(body.toString());
10 }
11
12 if (typeof body === "string") {
13 return safeJsonParse(body);
14 }
15
16 return body;
17}
18
19export const registerJobNamespace = (webhookKey: string) => `job:webhook.register.${webhookKey}`;

Callers 2

webhookHandlerFunction · 0.90
webhookHandlerFunction · 0.90

Calls 2

safeJsonParseFunction · 0.90
toStringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…