From 924d16a1a443ec218ac145d3e0a2c1b4bdf883fa Mon Sep 17 00:00:00 2001 From: Patrick Mueller Date: Tue, 11 Jan 2022 18:03:47 +0100 Subject: [PATCH] Last adjustments for the gym_id problem on backend side --- .../climbing_routes/climbingRoutes.router.ts | 5 +---- src/models/climbing-route-rating/common/VerifyCaptcha.ts | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) 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 559d756..211ebdb 100644 --- a/src/models/climbing-route-rating/climbing_routes/climbingRoutes.router.ts +++ b/src/models/climbing-route-rating/climbing_routes/climbingRoutes.router.ts @@ -201,10 +201,7 @@ 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', - 'query_params': req.query - }); + res.status(400).send({'message': 'Missing parameters'}); return; } diff --git a/src/models/climbing-route-rating/common/VerifyCaptcha.ts b/src/models/climbing-route-rating/common/VerifyCaptcha.ts index 54a3212..73cfea8 100644 --- a/src/models/climbing-route-rating/common/VerifyCaptcha.ts +++ b/src/models/climbing-route-rating/common/VerifyCaptcha.ts @@ -1,11 +1,11 @@ import * as dotenv from 'dotenv'; -import * as querystring from 'querystring'; +import * as querystring from 'qs'; import axios from 'axios'; dotenv.config(); export const verifyCaptcha = async (captcha_token: string): Promise => { - var postData = querystring.stringify({ + let postData = querystring.stringify({ response: captcha_token, secret: process.env.HCAPTCHA_SECRET });