ASGIRequest
Custom request subclass that decodes from an ASGI-standard request dict and wraps request body handling.
Attributes
| Attribute | Type | Description |
|---|---|---|
| body_receive_timeout | int = 60 | Number of seconds until a Request gives up on trying to read a request body and aborts. |
| POST | [QueryDict](../../../http/request/querydict.md?sid=django_http_request_querydict) | A dictionary-like object containing all given HTTP POST parameters, populated by parsing the request body. |
| FILES | [MultiValueDict](../../../utils/datastructures/multivaluedict.md?sid=django_utils_datastructures_multivaluedict) | A dictionary-like object containing all uploaded files, populated by parsing the request body. |
Constructor
Signature
def ASGIRequest(
scope: dict,
body_file: file-like object
)
Parameters
| Name | Type | Description |
|---|---|---|
| scope | dict | The ASGI scope dictionary containing request information. |
| body_file | file-like object | The file-like object representing the request body stream. |
Methods
GET()
@classmethod
def GET() - > [QueryDict](../../../http/request/querydict.md?sid=django_http_request_querydict)
Retrieves the query parameters parsed from the request's query string as a QueryDict.
Returns
| Type | Description |
|---|---|
[QueryDict](../../../http/request/querydict.md?sid=django_http_request_querydict) | A dictionary-like object containing all GET parameters provided in the URL. |
COOKIES()
@classmethod
def COOKIES() - > dict
Parses the 'HTTP_COOKIE' header from the request metadata and returns a dictionary of cookie names and values.
Returns
| Type | Description |
|---|---|
dict | A dictionary mapping cookie names to their respective string values. |
close()
@classmethod
def close() - > null
Closes the request resources, specifically ensuring the underlying body file stream is properly shut down.
Returns
| Type | Description |
|---|---|
null |