From 561fbf0a751577c72db03ef4fa0a8e60ecc9f941 Mon Sep 17 00:00:00 2001 From: Patrick Mueller Date: Tue, 11 Jan 2022 17:07:22 +0100 Subject: [PATCH] Debugging routes POST --- .../climbing_routes/climbingRoutes.router.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/models/climbing-route-rating/climbing_routes/climbingRoutes.router.ts b/src/models/climbing-route-rating/climbing_routes/climbingRoutes.router.ts index 211ebdb..600e7bc 100644 --- a/src/models/climbing-route-rating/climbing_routes/climbingRoutes.router.ts +++ b/src/models/climbing-route-rating/climbing_routes/climbingRoutes.router.ts @@ -201,7 +201,23 @@ climbingRoutesRouter.post('/', async (req: Request, res: Response) => { let captcha_token = req.query['hcaptcha_response'] as string; if (isNaN(gym_id) || !name || !difficulty || !captcha_token) { - res.status(400).send({'message': 'Missing parameters'}); + let missing = ''; + if (isNaN(gym_id)) { + missing += 'gym_id;'; + } else if (!name) { + missing += 'name;'; + } else if (!difficulty) { + missing += 'difficulty;'; + } else if (!captcha_token) { + missing += 'token;'; + } else { + missing += 'all good'; + } + + res.status(400).send({ + 'message': 'Missing parameters', + 'missing': missing + }); return; }