TestClient class
A test client for making HTTP requests to a server.
Constructors
- TestClient({String host = 'localhost', int port = 8282})
- Creates instance of TestClient.
Properties
Methods
-
close(
) → Future< void> - Closes the client and cleans up any associated resources.
-
delete(
Uri url, {Map< String, String> ? headers, Object? body, Encoding? encoding}) → Future<Response> -
Sends an HTTP DELETE request to the specified
url
.inherited -
get(
Uri url, {Map< String, String> ? headers}) → Future<Response> -
Sends an HTTP GET request to the specified
url
.inherited -
handle(
Handler handler) → Future< void> - Mounts Handler to this client.
-
head(
Uri url, {Map< String, String> ? headers}) → Future<Response> -
Sends an HTTP HEAD request to the specified
url
.inherited -
makeRequest(
String method, Uri url, {Map< String, String> ? headers, Object? body, Encoding? encoding}) → Request - Creates a new Request instance with the given parameters.
-
mount(
Application application) → Future< void> - Mounts Application to this client.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
patch(
Uri url, {Map< String, String> ? headers, Object? body, Encoding? encoding}) → Future<Response> -
Sends an HTTP PATCH request to the specified
url
.inherited -
post(
Uri url, {Map< String, String> ? headers, Object? body, Encoding? encoding}) → Future<Response> -
Sends an HTTP POST request to the specified
url
.inherited -
put(
Uri url, {Map< String, String> ? headers, Object? body, Encoding? encoding}) → Future<Response> -
Sends an HTTP PUT request to the specified
url
.inherited -
read(
Uri url, {Map< String, String> ? headers}) → Future<String> -
Sends an HTTP GET request to the specified
url
and returns the body as a String.inherited -
readBytes(
Uri url, {Map< String, String> ? headers}) → Future<Uint8List> -
Sends an HTTP GET request to the specified
url
and returns the body as a Uint8List.inherited -
send(
Request request) → Future< Response> -
Sends the given
request
and returns the response.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited