mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
await request.post_body() method, closes #897
This commit is contained in:
parent
c5f06bc356
commit
1f6a134369
3 changed files with 37 additions and 3 deletions
|
|
@ -90,8 +90,7 @@ class Request:
|
|||
def actor(self):
|
||||
return self.scope.get("actor", None)
|
||||
|
||||
async def post_vars(self):
|
||||
body = []
|
||||
async def post_body(self):
|
||||
body = b""
|
||||
more_body = True
|
||||
while more_body:
|
||||
|
|
@ -99,7 +98,10 @@ class Request:
|
|||
assert message["type"] == "http.request", message
|
||||
body += message.get("body", b"")
|
||||
more_body = message.get("more_body", False)
|
||||
return body
|
||||
|
||||
async def post_vars(self):
|
||||
body = await self.post_body()
|
||||
return dict(parse_qsl(body.decode("utf-8"), keep_blank_values=True))
|
||||
|
||||
@classmethod
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue