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})

Properties

auth → IAuth?
get auth class
no setteroverride
body ↔ Map<String, dynamic>
getter/setter pair
boundValues → Map<String, Object>
values from Route.bind, set before the controller runs
latefinal
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-Language header, like th. null when there is none.
no setter
method ↔ String
made on first use
getter/setter pairoverride
param ↔ Map<String, dynamic>
the route params, eg. {'id': '5'}
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
getter/setter pair
requestBody → RequestBody
The body as it was read, for DTOs. body is its map.
final
route → RouteData
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
session ↔ Session
The session of the request. Needs SessionMiddleware on 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
bound<T>(String param) → T
the value Route.bind made for the route param param.
get cookie value from header. An encrypted cookie that was changed, made with another key, or made for another cookie name gives null.
override
expectsJson() → bool
True when the client wants a JSON answer, not a page: an Accept header with json, a JSON body, or an X-Requested-With: XMLHttpRequest header. An Inertia request (X-Inertia) is not.
getRouteData() → RouteData
get route identifier
override
getRouteIdentifier() → String
get route identifier
override
has(String key) → bool
Check if input is present
override
Get header value
override
host() → String
get host|domain
override
input(String key) → dynamic
Get request value
override
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
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
referer() → String?
get referer
override
scheme() → String
http or https. Behind a proxy listed in trustedProxies this comes from X-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 T and give the typed object. Throws the 422 ValidationException when the input is not valid. source wins over the source of the DTO.
validateSchema<O>(Schema<O> schema) → Future<O>
Check the request (query and body) with a fluent dox_validation schema and give its output. Only for input you know at runtime.

Operators

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