postBytes method
Sends a POST request to the specified url and returns the response as a
JSON object.
Implementation
Future<(http.Response, Uint8List)> postBytes(
(Uri, Map<String, String>) composedRequest, {
Duration timeout = const Duration(seconds: 30),
Map<String, String>? headers,
Encoding? encoding,
}) async {
final url = composedRequest.$1;
final body = composedRequest.$2;
final response = await http
.post(
url,
headers: headers,
body: body,
encoding: encoding,
)
.handleExceptions(timeout: timeout);
return (response, response.bodyBytes);
}