DahoRequest class

The incoming HTTP request handed to route handlers and middleware.

Instances are pooled and reused across requests (see RequestPool), so fields are mutable and populated through reset rather than a constructor.

The request body is parsed lazily: body and files are only decoded the first time they are accessed, avoiding the cost of parsing for routes that never read the payload.

Constructors

DahoRequest()

Properties

body → dynamic
The parsed request body. JSON payloads become a Map/List, form fields become a Map<String, String>, otherwise the raw decoded text.
no setter
cookies Map<String, String>
Cookies sent by the client, parsed from the Cookie header on first access and cached for the request.
no setter
files Map<String, UploadedFile>
Files uploaded via multipart/form-data, keyed by form field name.
no setter
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>
getter/setter pair
ip String
getter/setter pair
method String
getter/setter pair
params Map<String, String>
getter/setter pair
path String
getter/setter pair
query Map<String, String>
getter/setter pair
rawBody Uint8List?
The undecoded request body, if any.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

Returns the value of request header name (case-insensitive), or null.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset({required String method, required String path, required Map<String, String> query, required String ip, required Map<String, String> headers, Uint8List? rawBody, void lazyParser(DahoRequest)?}) → void
Re-initializes this instance for a new request. Used by the object pool to recycle allocations.
setParsedData(dynamic body, Map<String, UploadedFile> files) → void
Stores the decoded body and files. Called by the lazy parser.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited