duck.http.request_data

Module providing classes for representing and storing HTTP request data.

Module Contents

Classes

RawRequestData

Represents raw, unparsed HTTP request data as a single byte stream.

RequestData

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.RequestData

Represents 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.

__repr__()[source]
__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_store dictionary 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’’.

__repr__()[source]
__slots__

(‘headers’, ‘content’, ‘request_store’)