mirror of
https://github.com/eliasrenman/gardentron.git
synced 2026-03-16 20:46:07 +01:00
fix: changed body collection
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user