( body: any, bodySchema: z.ZodType<any>, )
| 105 | }); |
| 106 | |
| 107 | export function isValidBody<T extends Record<string, unknown>>( |
| 108 | body: any, |
| 109 | bodySchema: z.ZodType<any>, |
| 110 | ): body is T { |
| 111 | const safeParseOut = bodySchema.safeParse(body); |
| 112 | if ("error" in safeParseOut) { |
| 113 | console.error( |
| 114 | "Error parsing request body: " + safeParseOut.error.toString(), |
| 115 | ); |
| 116 | } |
| 117 | return safeParseOut.success; |
| 118 | } |
nothing calls this directly
no outgoing calls
no test coverage detected