summary refs log tree commit diff
path: root/api/src/util/handlers/route.ts
diff options
context:
space:
mode:
Diffstat (limited to 'api/src/util/handlers/route.ts')
-rw-r--r--api/src/util/handlers/route.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/api/src/util/handlers/route.ts b/api/src/util/handlers/route.ts

index eaf7dc91..f8130f3c 100644 --- a/api/src/util/handlers/route.ts +++ b/api/src/util/handlers/route.ts
@@ -117,6 +117,11 @@ export function route(opts: RouteOptions) { const valid = validate(normalizeBody(req.body)); if (!valid) { const fields: Record<string, { code?: string; message: string }> = {}; + if(process.env.LOG_INVALID_BODY) { + console.log(`Got invalid request: ${req.method} ${req.originalUrl}`) + console.log(req.body) + validate.errors?.forEach(x => console.log(x.params)) + } validate.errors?.forEach((x) => (fields[x.instancePath.slice(1)] = { code: x.keyword, message: x.message || "" })); throw FieldErrors(fields); }