await request.post_body() method, closes #897

This commit is contained in:
Simon Willison 2020-07-17 13:12:35 -07:00
commit 1f6a134369
3 changed files with 37 additions and 3 deletions

View file

@ -48,11 +48,14 @@ The request object is passed to various plugin hooks. It represents an incoming
``.actor`` - dictionary (str -> Any) or None
The currently authenticated actor (see :ref:`actors <authentication_actor>`), or ``None`` if the request is unauthenticated.
The object also has one awaitable method:
The object also has two awaitable methods:
``await request.post_vars()`` - dictionary
Returns a dictionary of form variables that were submitted in the request body via ``POST``. Don't forget to read about :ref:`internals_csrf`!
``await request.post_body()`` - bytes
Returns the un-parsed body of a request submitted by ``POST`` - useful for things like incoming JSON data.
.. _internals_multiparams:
The MultiParams class