requestResource method

Future<RequestResponse> requestResource(
  1. ResourceRequestType type,
  2. RequestDetails details
)

Gets any type of resource

Implementation

Future<RequestResponse> requestResource(
    ResourceRequestType type, RequestDetails details) async {
  var owDetails = OWRequestDetails(
      path: details.path,
      method: details.method,
      headers: details.headers,
      body: details.body);
  var owResponse = await api.requestResource(type, owDetails);

  owResponse.headers
      .removeWhere((key, value) => key == null || value == null);
  var headers = Map<String, String>.from(owResponse.headers);

  return RequestResponse(
      headers: headers,
      body: owResponse.body,
      ok: owResponse.ok,
      status: owResponse.status);
}