active method

Future<String> active({
  1. dynamic body,
})

HTTP Method: GET Returns a simple "204" HTTP code, with no response, indicating that the service itself is up and running. Useful for liveliness probes or other external checks. Summary: /active

Implementation

Future<String> active({dynamic body}) async {
  final queryParams = <String, String>{};
  if (defaultToken != null) {
    queryParams['token'] = defaultToken!;
  }
  final pathUrl = '/active';
  final uri = Uri.parse(
    '$baseUrl$pathUrl',
  ).replace(queryParameters: queryParams.isNotEmpty ? queryParams : null);
  final request = http.Request('GET', uri);
  if (body != null) {
    request.headers['Content-Type'] = 'application/json';
    request.body = jsonEncode(body);
  }
  final streamedResponse = await _client.send(request);
  final response = await http.Response.fromStream(streamedResponse);
  if (response.statusCode != 200 && response.statusCode != 204) {
    throw Exception('HTTP ${response.statusCode}: ${response.body}');
  }
  if (response.statusCode == 204) return '';
  return response.body;
}