fix: changed body collection

This commit is contained in:
Elias Renman
2023-06-28 20:48:38 +02:00
parent 1eeb1d0d8e
commit b670057698
2 changed files with 2 additions and 18 deletions

View File

@@ -66,24 +66,8 @@ Please note that this only supports content-type 'application/json'
def get_body(request: str): def get_body(request: str):
req = request.split("\r\n") req = request.split("\r\n")
content_length_index = 100 out = req[len(req) - 1]
out = ""
for index in range(len(req)):
item = req[index]
if item.lower().find("content-type") != -1:
if not item.find("application/json"):
return
if item.lower().find("content-length") != -1:
content_length_index = index
if index > content_length_index:
out += item
out = out.replace("\n", "")
out = out.replace("\t", "")
print("Output", out)
if out != "": if out != "":
return out return out

View File

@@ -6,7 +6,7 @@
"moisture": { "moisture": {
"thresholds": { "thresholds": {
"lower": { "lower": {
"sensor_0": 50, "sensor_0": 60,
"sensor_1": 50, "sensor_1": 50,
"sensor_2": 50 "sensor_2": 50
}, },