From 8a1202bad3fab06fe396c6de3745f442a61366a2 Mon Sep 17 00:00:00 2001 From: Dexter Gaon-Shatford Date: Wed, 2 Nov 2022 15:38:49 -0400 Subject: [PATCH] fix(web): fix response to periodic POST requests (#344) The reason POST requests were being responded to with 400 is that in the assignment of payload, the request.json member is used if request.form evaluates as false, but accessing request.json results in an error for some requests, even though flask docs claim that the value will simply be `None`. resolves #339 --- interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface.py b/interface.py index 27480da..2229ed6 100644 --- a/interface.py +++ b/interface.py @@ -335,7 +335,7 @@ def status(): def post(): global log - payload = request.form if request.form else request.json + payload = request.get_json() if request.is_json else request.form if payload: log.debug("web: Post request from %s: %s" % (request.remote_addr, str(payload)))