post<T> function

Future<Response> post<T>(
  1. String uri, {
  2. Map<String, String>? headers,
  3. required dynamic body,
})

Implementation

Future<Response> post<T>(
  String uri, {
  Map<String, String>? headers,
  required dynamic body,
}) async {
  final info = "(POST) $uri";

  report(
    "Request $info\nRequestHeader $headers\nRequestBody ${const JsonEncoder.withIndent(" ").convert(body)}",
  );

  final response = await retry(
    () => http.post(
      Uri.parse(uri),
      headers: headers,
      body: toBody(body),
    ),
  );

  return transform(info, response);
}