How to get request body with content-type: Application/json
using python httptools?
I`m using it with uvloop.
The request class looks like this:
class HttpRequest:
__slots__ = ('_protocol', '_url', '_headers', '_version')
def __init__(self, protocol, url, headers, version):
self._protocol = protocol
self._url = url
self._headers = headers
self._version = version
You can add a method named
on_body
that will receive the body of the HTTP request as its parameter.The supported callback functions on the object you provide when creating a
HttpRequestParser
with httptools are: