CtxRequest class

Wrapper around HttpRequest offering convenient access to request data and the shared contextual extras map.

Constructors

CtxRequest(HttpRequest _request, {bool enableHijack = true})
Creates a wrapper around the incoming HttpRequest.

Properties

body ↔ CtxRequestBody
Helper exposing lazy parsing utilities for the request body.
latefinal
canHijack bool
Whether this request can currently be hijacked.
no setter
contentLength int?
Declared content length of the request, if known.
no setter
contentType ContentType?
Parsed content type header.
no setter
cookies Map<String, String>
Parsed cookies (first value wins on duplicate names).
no setter
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, List<String>>
Lowercased header names; values are unmodifiable lists.
no setter
host String?
Value of the Host header, if provided.
no setter
isFormUrlencoded bool
no setter
isHijacked bool
Whether the request has already been hijacked.
no setter
isHttps bool
Whether the request is served over HTTPS (directly or inferred).
no setter
isJson bool
no setter
isMultipart bool
no setter
method String
HTTP method of the incoming request.
no setter
path String
Path component of the request URI.
no setter
pathParameters Map<String, String>
Populated by the router via updatePathParameters.
no setter
queryParameters Map<String, String>
The URI query split into a map according to the rules specified for FORM post in the HTML 4.01 specification section 17.13.4.
no setter
queryParametersAll Map<String, List<String>>
Returns the URI query split into a map according to the rules specified for FORM post in the HTML 4.01 specification section 17.13.4.
no setter
raw HttpRequest
Access to the underlying HttpRequest.
no setter
remoteAddress InternetAddress?
Remote address associated with the underlying socket, if available.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
uri Uri
Full request URI including query parameters.
no setter
userAgent String?
Reported user agent string, if provided.
no setter

Methods

accepts(String mime) bool
Returns true if the Accept header allows the provided mime type.
bestMatch(Iterable<String> mimes) String?
Returns the best match from mimes based on Accept (very small impl). If no Accept header, returns the first offered.
Looks up a cookie value by name, if present.
First value of a header (case-insensitive) or null.
hijack(FutureOr<void> callback(HttpRequest request)) → Never
Hands control of the underlying HttpRequest to callback.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pathParameter(String key) String
Retrieves a path parameter based on a key. In case, no path parameter is available, it returns an empty string.
toString() String
A string representation of this object.
inherited

Operators

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