Request class
An HTTP request for the Ruta framework.
Constructors
-
Request(String method, Uri uri, {Map<
String, Object> ? headers, Object? body, Encoding? encoding, Map<String, dynamic> ? data}) - Default constructor
-
Request.delete(Uri uri, {Map<
String, Object> ? headers, Object? body, Encoding? encoding}) - An HTTP DELETE request.
-
Request.get(Uri uri, {Map<
String, Object> ? headers, Object? body, Encoding? encoding}) - An HTTP GET request.
-
Request.post(Uri uri, {Map<
String, Object> ? headers, Object? body, Encoding? encoding}) - An HTTP POST request.
-
Request.put(Uri uri, {Map<
String, Object> ? headers, Object? body, Encoding? encoding}) - An HTTP PUT request.
Properties
- connectionInfo → HttpConnectionInfo
-
Connection information for the associated HTTP request.
no setter
-
context
→ Map<
String, Object> -
The context from
shelfrequestno setter -
data
→ Map<
String, dynamic> -
Request Data after validation
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> -
The HTTP headers with case-insensitive keys.
The returned map is unmodifiable.
no setter
- method → HttpMethod
-
The HttpMethod associated with the request.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- uri → Uri
-
The original requested Uri.
no setter
- url → Uri
-
The requested URL relative to the current handler path.
no setter
- userAgent → String?
-
The User Agent of request
no setter
Methods
-
body(
) → Future< String> - Returns a Future containing the body as a String.
-
bytes(
) → Stream< List< int> > - Returns a Stream representing the body.
-
copyWith(
{Map< String, Object?> ? headers, Map<String, Object?> ? context, Map<String, dynamic> ? newData, String? path, Object? body}) → Request - Creates a new Request by copying existing values and applying specified changes.
-
formData(
) → Future< FormData> - Returns a Future containing the form data as a Map.
-
json(
) → Future -
Returns a Future containing the JSON-decoded body.
Updates the
datafield to ensure it reflects the freshly parsed body. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
validate(
{List< Field< body = const [], List<Object> >Field< query = const []}) → Future<Object> >ValidationResult> - Validates the request body and query parameters against the provided schemas.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited