resolveAHttpRequest function

Future<Response> resolveAHttpRequest(
  1. String host,
  2. String fileUrl, {
  3. String? method,
  4. Map<String, String>? header,
  5. String? body,
  6. Map<String, String>? labels,
})

Gopeed api: Resolve a request. method: POST

Implementation

Future<http.Response> resolveAHttpRequest(String host, String fileUrl,
    {String? method,
    Map<String, String>? header,
    String? body,
    Map<String, String>? labels}) {
  Uri targetUri = Uri.http(host, "/api/v1/resolve");

  Map<String, dynamic> payload = {"url": fileUrl};
  if (method != null || header != null || body != null) {
    payload["extra"] =
        _buildHttpExtra(method: method, header: header, body: body);
  }
  if (labels != null) {
    payload["labels"] = labels;
  }

  return http.post(targetUri, body: convert.jsonEncode(payload));
}