duck.http.request_data¶
Module providing classes for representing and storing HTTP request data.
Module Contents¶
Classes¶
Represents raw, unparsed HTTP request data as a single byte stream. |
|
Represents a parsed HTTP request with headers and body content. |
API¶
- class duck.http.request_data.RawRequestData(data: bytes)[source]¶
Bases:
duck.http.request_data.RequestDataRepresents raw, unparsed HTTP request data as a single byte stream.
This class stores the entire HTTP request (headers and body) as raw bytes, suitable for use in low-level HTTP request handling or custom parsing logic.
Initialization
Initialize a new RawRequestData instance.
- Parameters:
data – The full raw HTTP request in bytes, including headers and body.
- __slots__¶
(‘data’, ‘request_store’)
- class duck.http.request_data.RequestData(headers: Dict[str, str], content: bytes = b'')[source]¶
Represents a parsed HTTP request with headers and body content.
This class is used to store and manage headers and raw body data extracted from an incoming HTTP request. It also includes a flexible
request_storedictionary for attaching arbitrary metadata that can be used throughout request handling.Initialization
Initialize a new RequestData instance.
- Parameters:
headers – Dictionary of HTTP request headers.
content – Raw body content of the request. Defaults to b’’.
- __slots__¶
(‘headers’, ‘content’, ‘request_store’)