runRequest method

Future<Response> runRequest(
  1. ApiRequest request
)

Implementation

Future<http.Response> runRequest(ApiRequest request) {
  var uri = _buildUri(request);
  // print('rrrrrrrrrrrr $uri');
  switch (request.method) {
    case ApiMethods.delete:
      return http.delete(uri,
          headers: request.headers, body: jsonEncode(request.body));
    case ApiMethods.patch:
      return http.patch(uri,
          headers: request.headers, body: jsonEncode(request.body));
    case ApiMethods.head:
      return http.head(uri, headers: request.headers);
    case ApiMethods.post:
      return http.post(uri,
          headers: request.headers, body: jsonEncode(request.body));
    case ApiMethods.put:
      return http.put(uri,
          headers: request.headers, body: jsonEncode(request.body));
    default:
      return http.get(uri, headers: request.headers);
  }
}