TestRequest class Null safety
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.
write-only
- baseURL ↔ String
-
The base URL of the request.
read / write
- bearerAuthorization ← String
-
Sets the Authorization header of this request.
write-only
- body ↔ dynamic
-
The body of the this request.
read / write
- contentType ↔ ContentType
-
The Content-Type that body should be encoded in.
read / write
- encodeBody ↔ bool
-
Whether or not body should be encoded according to contentType.
read / write
- hashCode → int
-
The hash code for this object.
read-onlyinherited
-
headers
↔ Map<
String, dynamic> -
HTTP headers to add to the request.
read / write
- path ↔ String?
-
The path of the request; will be appended to baseURL.
read / write
-
query
↔ Map<
String, dynamic> -
Query parameters to add to the request.
read / write
- requestURL → String
-
The full URL of this request.
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
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 non-existent 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