TestRequest class
Object to construct and execute an HTTP request during testing.
Test requests are typically executed via methods in Agent (e.g., Agent.get). For more granular configuration than provided by those methods, directly configure an this object and execute it with methods like get or post.
Use Agent.request to create instances of this type.
Properties
-
accept
← List<
ContentType> -
Sets the Accept header of this request.
no getter
- baseURL ↔ String
-
The base URL of the request.
getter/setter pair
- bearerAuthorization ← String
-
Sets the Authorization header of this request.
no getter
- body ↔ dynamic
-
The body of the this request.
getter/setter pair
- contentType ↔ ContentType
-
The Content-Type that body should be encoded in.
getter/setter pair
- encodeBody ↔ bool
-
Whether or not body should be encoded according to contentType.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
↔ Map<
String, dynamic> -
HTTP headers to add to the request.
getter/setter pair
- path ↔ String?
-
The path of the request; will be appended to baseURL.
getter/setter pair
-
query
↔ Map<
String, dynamic> ? -
Query parameters to add to the request.
getter/setter pair
- requestURL → String
-
The full URL of this request.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
delete(
) → Future< TestResponse> - Executes this request with HTTP DELETE.
-
get(
) → Future< TestResponse> - Executes this request with HTTP GET.
-
method(
String verb) → Future< TestResponse> - Executes this request with the given HTTP verb.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
post(
) → Future< TestResponse> - Executes this request with HTTP POST.
-
put(
) → Future< TestResponse> - Executes this request with HTTP PUT.
-
setBasicAuthorization(
String username, String password) → void - Sets the Authorization header of this request.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited