Skip to main content

ASGIRequest

Custom request subclass that decodes from an ASGI-standard request dict and wraps request body handling.

Attributes

AttributeTypeDescription
body_receive_timeoutint = 60Number 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

NameTypeDescription
scopedictThe ASGI scope dictionary containing request information.
body_filefile-like objectThe 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

TypeDescription
[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

TypeDescription
dictA 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

TypeDescription
null