Request Object
The request object is a dataclass that contains all the information about the request. It is available in the route handler as the first argument.
The request object is created in Rust side but is exposed to Python as a dataclass.
Attributes:
queries (dict[str, str]): The query parameters of the request.
e.g. /user?id=123 -> {"id": "123"}
headers (dict[str, str]): The headers of the request.
e.g. {"Content-Type": "application/json"}
params (dict[str, str]): The parameters of the request.
e.g. /user/:id -> {"id": "123"}
body (Union[str, bytes]): The body of the request. If the request is a JSON, it will be a dict.
method (str): The method of the request.
e.g. GET, POST, PUT, DELETE
ip_addr (Optional[str]): The IP Address of the client
identity (Optional[Identity]): The identity of the client
Request
@dataclass
class Request:
"""
queries: dict[str, str]
headers: dict[str, str]
path_params: dict[str, str]
body: Union[str, bytes]
method: str
url: Url
ip_addr: Optional[str]
identity: Optional[Identity]
"""
What's next?
Now, Batman wanted to understand the configuration of the Robyn server. He was then introduced to the concept of Robyn env files.