Skip to content

Commit

Permalink
Updated keys from body to be case sensitive and updated typing of val…
Browse files Browse the repository at this point in the history
…ues due to TypeError
  • Loading branch information
IvanC112 committed Jun 11, 2024
1 parent d79d7a8 commit 39d73ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions middlewares/validate.ts
Original file line number Diff line number Diff line change
@@ -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,
) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 39d73ac

Please sign in to comment.