apiTest<T extends ApiService> method
Implementation
Future<void> Function() apiTest<T extends ApiService>(
FutureOr<void> Function(RestClient client) body) {
return test(() async {
final api = resolve<T>();
final client = await RestClient.connectHttp2(
Uri(
scheme: 'http',
host: InternetAddress.loopbackIPv4.host,
port: api.port,
path: api.basePath,
),
);
try {
await body(client);
} finally {
await client.close();
}
});
}