From 39d73ac20819e97c7a5025d2d684b6d27ff2a046 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Tue, 11 Jun 2024 13:48:42 -0400 Subject: [PATCH] Updated keys from body to be case sensitive and updated typing of values due to TypeError --- middlewares/validate.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/middlewares/validate.ts b/middlewares/validate.ts index 19f958e..646e52a 100644 --- a/middlewares/validate.ts +++ b/middlewares/validate.ts @@ -1,7 +1,7 @@ //validate all fields and their types function validating( keys: string[], - values: (string | number)[], + values: any, requiredFields: { [key: string]: string }, res: any, ) { @@ -40,7 +40,7 @@ const validate = (req: any, res: any, next: any) => { topic: "object", }; const values = Object.values(req.body); - const keys = Object.keys(req.body).toString().toLowerCase().split(","); + const keys = Object.keys(req.body); if (req.method === "POST") { //initial check for empty request body