0
如何獲得請求正文content-type: Application/json
使用python httptools? 我使用它與uvloop。如何使用httptools從請求中獲取正文?
請求類看起來是這樣的:
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
你說的是[httptools(https://github.com/MagicStack/httptools)?在這種情況下,請看'on_body'。你有什麼嘗試? – MatsLindh
解決!是的,謝謝@MatsLindh,我在我的HttpProtocol實現中添加on_body方法,如下所示: def on_body(self,body): self._body = body – Lem