Skip to content

Commit bc46b67

Browse files
committed
Fixed: Support for query params without value
1 parent 6c5e201 commit bc46b67

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

adafruit_httpserver/request.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,14 @@ def _parse_start_line(header_bytes: bytes) -> Tuple[str, str, Dict[str, str], st
4747
if "?" not in path: path += "?"
4848

4949
path, query_string = path.split("?", 1)
50-
query_params = dict([param.split("=", 1) for param in query_string.split("&")]) if query_string else {}
50+
51+
query_params = {}
52+
for query_param in query_string.split("&"):
53+
if "=" in query_param:
54+
key, value = query_param.split("=", 1)
55+
query_params[key] = value
56+
else:
57+
query_params[query_param] = ""
5158

5259
return method, path, query_params, http_version
5360

0 commit comments

Comments
 (0)