Skip to content

Commit

Permalink
Update methodWhitelist.ts
Browse files Browse the repository at this point in the history
update methodWhitelist status code
  • Loading branch information
S0naliThakur authored Aug 30, 2024
1 parent 9c7649c commit 265c8dd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/middlewares/methodWhitelist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const allowedMethods = Object.keys(methods);
export const methodWhitelist = (req: Request, res: Response, next: NextFunction) => {
const method = req.body?.method;
if (method && !allowedMethods.includes(method)) {
return res.status(404).json({ error: 'Method not found' });
return res.status(403).json({ error: 'Forbidden' });
}
next();
};
};

0 comments on commit 265c8dd

Please sign in to comment.