pressure method
HTTP Method: GET Returns a JSON body of stats related to the pressure being exerted on the instance. This route is dynamic based upon the supplied "Accept" header, and will either return a human-readable message if the "Accept" header is set to "text/plain", or the default JSON body and a 200 HTTP code.
When Accept is set to "text/plain" a human-readable message is sent back describing the state of the container, and either a "200" code (indicating "ok") or a "503" code (indicating that the service is unavailable due to load).
If the "Accept" header is set to anything else it will return a JSON body with the same information. Summary: /pressure
Implementation
Future<Map<String, dynamic>> pressure({dynamic body}) async {
final queryParams = <String, String>{};
if (defaultToken != null) {
queryParams['token'] = defaultToken!;
}
final pathUrl = '/pressure';
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 jsonDecode(response.body);
}