DoxRequest class
- Implemented types
Constructors
-
DoxRequest({required RouteData route, required Uri uri, required Map<
String, dynamic> body, ContentType? contentType, String? clientIp, String scheme = 'http', required HttpHeaders httpHeaders, required HttpRequest httpRequest, RequestBody? requestBody, bool readClient = false, Map<String, dynamic> ? params})
Properties
- auth ↔ IAuth?
-
the auth of the logged in user.
AuthMiddlewareandAuth.setUserset it. It is not in the input (query and body), so a client field can not set it.getter/setter pairoverride -
body
↔ Map<
String, dynamic> -
getter/setter pair
-
boundValues
→ Map<
String, Object> -
values from
Route.bind, set before the controller runslatefinal - clientIp → String?
-
no setter
- contentType → ContentType?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasSession → bool
-
True when the request has a session, see session.
no setter
-
headers
→ Map<
String, dynamic> -
Get all headers value
no setteroverride
- httpHeaders → HttpHeaders
-
final
- httpRequest → HttpRequest
-
final
- locale → String?
-
The first language of the
Accept-Languageheader, liketh.nullwhen there is none.no setter - method ↔ String
-
the request method, so a HEAD request on a GET route says HEAD
getter/setter pairoverride
-
param
↔ Map<
String, dynamic> -
the route params, eg.
{'id': '5'}. each request has its own map.getter/setter pair -
pathParams
→ Map<
String, String> -
The path params as text, like
{'id': '5'}.no setter -
query
↔ Map<
String, dynamic> -
the query string, read on first use. bracket keys nest, like the
body:
?tags[]=a&tags[]=bgives{'tags': ['a', 'b']}.getter/setter pair - requestBody → RequestBody
-
The body as it was read, for DTOs.
bodyis its map.final - requestId ↔ String?
-
The id of this request, set by the
RequestIdmiddleware. Null when the route does not use it.getter/setter pair - route → RouteData
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- session ↔ Session
-
The session of the request. Needs
SessionMiddlewareon the route.getter/setter pair - uri ↔ Uri
-
getter/setter pairoverride
Methods
-
add(
String key, dynamic value) → void -
Add new request value
override
-
all(
) → Map< String, dynamic> -
Get all request from body and query
override
-
bearerToken(
) → String? -
The token of an
Authorization: Bearer <token>header, or null. -
boolean(
String key, [bool defaultValue = false]) → bool -
The input as a bool.
true,1,onandyesgive true. Any other value gives false.defaultValueis given when the key is not there. -
bound<
T> (String param) → T -
the value
Route.bindmade for the route paramparam. -
get cookie value from header.
An encrypted cookie that was changed, made with another key, or
made for another cookie name gives null.
override
-
except(
List< String> keys) → Map<String, dynamic> -
The input without
keys. -
exists(
String key) → bool -
True when the key is in the input, with any value (also
''or null). Dot keys work. -
expectsJson(
) → bool -
True when the client wants a JSON answer, not a page: an
Acceptheader with json, a JSON body, or anX-Requested-With: XMLHttpRequestheader. An Inertia request (X-Inertia) is not. -
file(
String key) → RequestFile? - The uploaded file of the key, or null when it is not a file. For a field with many files, use input.
-
filled(
String key) → bool - True when the key is in the input and is not empty: not null, not a blank string, not an empty list or map. Dot keys work.
-
fullUrl(
) → String -
The full URL with the query string, like
https://example.com/users?page=2. -
getRouteData(
) → RouteData -
get route identifier
override
-
getRouteIdentifier(
) → String -
get route identifier
override
-
has(
String key) → bool -
Check if input is present
override
-
hasFile(
String key) → bool - True when the key holds an uploaded file, or a list of files.
-
header(
String key) → String? -
Get header value
override
-
host(
) → String -
get host|domain
override
-
input(
String key, [dynamic defaultValue]) → dynamic -
Get request value
override
-
integer(
String key, [int defaultValue = 0]) → int -
The input as an int.
defaultValueis given when the key is not there or the value is not a number. -
ip(
) → String -
Get user IP
override
-
isFormData(
) → bool -
http request data is form data
override
-
isJson(
) → bool -
http request data is json
override
-
isSecure(
) → bool - true when the client used https (see scheme)
-
merge(
Map< String, dynamic> values) → void -
Merge request values
override
-
missing(
String key) → bool - True when the key is not in the input. The opposite of exists.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
only(
List< String> keys) → Map<String, dynamic> -
Get Only specific request from body and query
override
-
origin(
) → String? -
get origin
override
-
path(
) → String -
The path of the request, like
/users/5. -
pathIs(
String pattern) → bool -
True when the path matches
pattern.*matches any text. The path andpatternare cleaned like the router does://is one/, and a/at the start or the end does not matter. So/admin/and/admin//both matchadmin, like they reach the/adminroute. (isis a Dart keyword.) -
referer(
) → String? -
get referer
override
-
routeIs(
String pattern) → bool -
True when the route name matches
pattern.*matches any text. -
scheme(
) → String -
httporhttps. Behind a proxy listed intrustedProxiesthis comes fromX-Forwarded-Proto. Dart itself only serves plain http. -
toJson(
) → Map< String, dynamic> -
To support jsonEncode
override
-
toString(
) → String -
A string representation of this object.
inherited
-
userAgent(
) → String -
get user agent from header
override
-
validate<
T> ({Source? source}) → Future< T> -
Check the request with the DTO
Tand give the typed object. Throws the 422 ValidationException when the input is not valid.sourcewins over thesourceof the DTO. -
validateSchema<
O> (Schema< O> schema) → Future<O> -
Check the request (query and body) with a fluent
dox_validationschema and give its output. Only for input you know at runtime.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited