I'm writing a plugin (simonw/datasette-insert#2) that implements an API for inserting JSON data. As such, I'd like to POST a JSON blob rather than using key=value form encoded data.
Right now there's a request.post_vars() method but no request.post_body() one:
|
async def post_vars(self): |
|
body = [] |
|
body = b"" |
|
more_body = True |
|
while more_body: |
|
message = await self.receive() |
|
assert message["type"] == "http.request", message |
|
body += message.get("body", b"") |
|
more_body = message.get("more_body", False) |
|
|
|
return dict(parse_qsl(body.decode("utf-8"), keep_blank_values=True)) |
I'm writing a plugin (simonw/datasette-insert#2) that implements an API for inserting JSON data. As such, I'd like to
POSTa JSON blob rather than usingkey=valueform encoded data.Right now there's a
request.post_vars()method but norequest.post_body()one:datasette/datasette/utils/asgi.py
Lines 93 to 103 in c5f06bc