Warning: Bocadillo is now UNMAINTAINED. Users are recommended to migrate to a supported alternative, such as Starlette or FastAPI. Please see #344 for more information.



Request(self, scope:MutableMapping[str, Any], receive:Callable[[], Awaitable[MutableMapping[str, Any]]]=<function empty_receive at 0x7f4aa7b9c0d0>, send:Callable[[MutableMapping[str, Any]], Awaitable[NoneType]]=<function empty_send at 0x7f4aa572b598>)

The request object, passed to HTTP views and typically named req.

This is a subclass of Starlette.requests.Request. As a result, all methods and attributes on Starlette's Request are available on this class. Additional or redefined members are documented here.

For usage tips, see Requests (Guide).


__aiter__: shortcut for .stream(). Allows to process the request body in byte chunks using async for chunk in req: ....


Request.json(self) -> Any

Parse the request body as JSON.


json (dict): the result of json.loads(await self.body()).


  • HTTPError(400): if the JSON is malformed.