We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 752dcaf commit e5f506bCopy full SHA for e5f506b
adafruit_httpserver/request.py
@@ -17,6 +17,8 @@
17
except ImportError:
18
pass
19
20
+import json
21
+
22
from .headers import Headers
23
24
@@ -115,6 +117,10 @@ def body(self) -> bytes:
115
117
def body(self, body: bytes) -> None:
116
118
self.raw_request = self._raw_header_bytes + b"\r\n\r\n" + body
119
120
+ def json(self) -> Union[dict, None]:
121
+ """Body of the request, as a JSON-decoded dictionary."""
122
+ return json.loads(self.body) if self.body else None
123
124
@property
125
def _raw_header_bytes(self) -> bytes:
126
"""Returns headers bytes."""
0 commit comments