request#
- class starlite.connection.request.Request#
Bases:
Generic
[User
,Auth
],ASGIConnection
[HTTPRouteHandler
,User
,Auth
]The Starlite Request class.
- __init__(scope: Scope, receive: Receive = <function empty_receive>, send: Send = <function empty_send>) None #
Initialize
Request
.- Parameters:
scope – The ASGI connection scope.
receive – The ASGI receive function.
send – The ASGI send function.
- property content_type: Tuple[str, Dict[str, str]]#
Parse the request’s ‘Content-Type’ header, returning the header value and any options as a dictionary.
- Returns:
A tuple with the parsed value and a dictionary containing any options send in it.
- async msgpack() Any #
Retrieve the MessagePack request body from the request.
- Returns:
An arbitrary value
- async stream() AsyncGenerator[bytes, None] #
Return an async generator that streams chunks of bytes.
- Returns:
An async generator.
- Raises:
RuntimeError – if the stream is already consumed
- async body() bytes #
Return the body of the request.
- Returns:
A byte-string representing the body of the request.
- async form() FormMultiDict #
Retrieve form data from the request. If the request is either a ‘multipart/form-data’ or an ‘application/x-www-form- urlencoded’, return a FormMultiDict instance populated with the values sent in the request, otherwise, an empty instance.
- Returns:
A FormMultiDict instance