mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Simplify http component
This commit is contained in:
parent
106a229a27
commit
931f7e8615
@ -178,12 +178,8 @@ class RequestHandler(SimpleHTTPRequestHandler):
|
|||||||
""" Does some common checks and calls appropriate method. """
|
""" Does some common checks and calls appropriate method. """
|
||||||
url = urlparse(self.path)
|
url = urlparse(self.path)
|
||||||
|
|
||||||
# Read query input
|
# Read query input. parse_qs gives a list for each value, we want last
|
||||||
data = parse_qs(url.query)
|
data = {key: data[-1] for key, data in parse_qs(url.query).items()}
|
||||||
|
|
||||||
# parse_qs gives a list for each value, take the latest element
|
|
||||||
for key in data:
|
|
||||||
data[key] = data[key][-1]
|
|
||||||
|
|
||||||
# Did we get post input ?
|
# Did we get post input ?
|
||||||
content_length = int(self.headers.get(HTTP_HEADER_CONTENT_LENGTH, 0))
|
content_length = int(self.headers.get(HTTP_HEADER_CONTENT_LENGTH, 0))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user