From c974abe8b431898d267a254f86bd7696e67c85c5 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Sun, 12 Jan 2025 11:12:30 -0600 Subject: [PATCH] fix validation messages when missing request body --- src/api/plugins/validate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/plugins/validate.ts b/src/api/plugins/validate.ts index ca3c0ba..cf948b7 100644 --- a/src/api/plugins/validate.ts +++ b/src/api/plugins/validate.ts @@ -16,7 +16,7 @@ const zodValidationPlugin: FastifyPluginAsync = async (fastify, _options) => { zodSchema: z.ZodTypeAny, ): Promise { try { - await zodSchema.parseAsync(request.body); + await zodSchema.parseAsync(request.body || {}); } catch (e: unknown) { if (e instanceof ZodError) { throw new ValidationError({