From afa00b57d69d64dd6bfdac2693f68b451ba9e589 Mon Sep 17 00:00:00 2001 From: Ales Puchilo <36516972+SaveTheAles@users.noreply.github.com> Date: Wed, 29 May 2024 17:19:35 +0200 Subject: [PATCH] Added request body check --- tx_service/app.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tx_service/app.py b/tx_service/app.py index 7e32e9e4..b36de9ff 100644 --- a/tx_service/app.py +++ b/tx_service/app.py @@ -40,6 +40,12 @@ def handle_tx(): # Parse the JSON request body req_body = request.get_json() + # Check the request body + if "proof" not in req_body.keys(): + return jsonify({"status": "fail", "error": "There is no proof value"}) + if "pubkey" not in req_body.keys(): + return jsonify({"status": "fail", "error": "There is no pubkey value"}) + # Extract the transaction data from the request body proof = req_body["proof"] pubkey = req_body["pubkey"]