Request class
Represents an HTTP request and provides various utilities to access request data and metadata.
Constructors
-
Request(HttpRequest httpRequest, Map<
String, dynamic> pathParameters, EngineConfig config) - Constructs a Request object.
Properties
-
bytes
→ Future<
Uint8List> -
Returns the body of the request as bytes.
no setter
- certificate → X509Certificate?
-
Returns the client certificate of the client making the request.
no setter
- clientIP → String
-
Returns the IP address of the client making the request.
no setter
- config ↔ EngineConfig
-
getter/setter pair
- connectionInfo → HttpConnectionInfo?
-
Information about the client connection.
no setter
- contentLength → int
-
Returns the content length of the request body.
no setter
- contentType → ContentType?
-
Returns the content type of the request, if available.
no setter
-
Returns the cookies sent with the request.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- headers → HttpHeaders
-
Returns the headers of the request.
no setter
- host → String
-
Returns the host of the request.
no setter
- httpRequest → HttpRequest
-
The underlying HttpRequest object.
final
- id → String
-
A unique identifier for the request.
final
- method → String
-
Returns the HTTP method of the request (e.g., GET, POST).
no setter
- path → String
-
Returns the path of the request URI.
no setter
-
pathParameters
→ Map<
String, dynamic> -
A map of path parameters extracted from the request URI.
final
- persistentConnection → bool
-
Returns the persistent connection state signaled by the client.
no setter
- protocolVersion → String
-
Returns the HTTP protocol version used in the request, either "1.0" or "1.1".
no setter
-
queryParameters
→ Map<
String, String> -
A map of query parameters extracted from the request URI.
final
- remoteAddr → String
-
Returns the remote address of the client making the request.
no setter
- requestedUri → Uri
-
Returns the requested URI for the request.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scheme → String
-
Returns the scheme of the request URI (e.g., http, https).
no setter
- session → HttpSession
-
Returns the session for the given request.
no setter
- startedAt → DateTime
-
Timestamp indicating when the request handling began.
final
-
stream
→ Stream<
List< int> > -
Returns a stream of the request body data.
no setter
- uri → Uri
-
Returns the URI of the request.
no setter
Methods
-
body(
) → FutureOr< String> - Returns the body of the request as a UTF-8 decoded string.
-
clearAttributes(
) → void - Clears all request-scoped attributes.
-
getAttribute<
T> (String key) → T? -
Retrieves a request-scoped attribute by
key. -
header(
String name) → String -
Returns the value of the specified header
name. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
overrideClientIp(
String ip) → void -
setAttribute(
String key, dynamic value) → void -
Sets a request-scoped attribute with the given
keyandvalue. Store a valuevalueunderkey. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited