From e47063207cec544b8045b9ab2715403356787d99 Mon Sep 17 00:00:00 2001 From: Thomas Rubini <74205383+ThomasRubini@users.noreply.github.com> Date: Thu, 1 Dec 2022 10:50:04 +0100 Subject: [PATCH] Always return 200 for consistency --- truthseeker/routes/routes_api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/truthseeker/routes/routes_api.py b/truthseeker/routes/routes_api.py index 52e5467..74760f2 100644 --- a/truthseeker/routes/routes_api.py +++ b/truthseeker/routes/routes_api.py @@ -14,13 +14,13 @@ def jwt_required(f): def decorator(*args, **kwargs): jwt_str = flask.request.args.get("jwt") if not jwt_str: - return {"status": "Error, JWT token missing"}, 401 + return {"status": "Error, JWT token missing"} try: claims = jwt.decode(jwt_str, truthseeker.app.config['SECRET_KEY'], algorithms=['HS256']) except jwt.exceptions.InvalidTokenError as e: print("Caught exception while decoding JWT token :", e) - return {"status": "Error, invalid JWT"}, 401 + return {"status": "Error, invalid JWT"} return f(claims, *args, **kwargs) return decorator