request method

Future<HttpResponse> request(
  1. HttpClient client,
  2. HttpMethod method,
  3. String url, {
  4. Map<String, String>? headers,
  5. Authorization? authorization,
  6. Map<String, String?>? queryParameters,
  7. bool noQueryString = false,
  8. Object? body,
  9. String? contentType,
  10. String? accept,
  11. String? responseType,
  12. ProgressListener? progressListener,
})

Implementation

Future<HttpResponse> request(HttpClient client, HttpMethod method, String url,
    {Map<String, String>? headers,
    Authorization? authorization,
    Map<String, String?>? queryParameters,
    bool noQueryString = false,
    Object? body,
    String? contentType,
    String? accept,
    String? responseType,
    ProgressListener? progressListener}) {
  switch (method) {
    case HttpMethod.GET:
      return requestGET(client, url,
          headers: headers,
          authorization: authorization,
          queryParameters: queryParameters,
          noQueryString: noQueryString,
          accept: accept,
          responseType: responseType,
          progressListener: progressListener);
    case HttpMethod.HEAD:
      return requestHEAD(client, url,
          headers: headers,
          authorization: authorization,
          queryParameters: queryParameters,
          noQueryString: noQueryString,
          progressListener: progressListener);
    case HttpMethod.OPTIONS:
      return requestOPTIONS(client, url,
          headers: headers,
          authorization: authorization,
          queryParameters: queryParameters,
          noQueryString: noQueryString,
          progressListener: progressListener);
    case HttpMethod.POST:
      return requestPOST(client, url,
          headers: headers,
          authorization: authorization,
          queryParameters: queryParameters,
          noQueryString: noQueryString,
          body: body,
          contentType: contentType,
          accept: accept,
          responseType: responseType,
          progressListener: progressListener);
    case HttpMethod.PUT:
      return requestPUT(client, url,
          headers: headers,
          authorization: authorization,
          queryParameters: queryParameters,
          noQueryString: noQueryString,
          body: body,
          contentType: contentType,
          accept: accept,
          responseType: responseType,
          progressListener: progressListener);
    case HttpMethod.PATCH:
      return requestPATCH(client, url,
          headers: headers,
          authorization: authorization,
          queryParameters: queryParameters,
          noQueryString: noQueryString,
          body: body,
          contentType: contentType,
          accept: accept,
          responseType: responseType,
          progressListener: progressListener);
    case HttpMethod.DELETE:
      return requestDELETE(client, url,
          headers: headers,
          authorization: authorization,
          queryParameters: queryParameters,
          noQueryString: noQueryString,
          body: body,
          contentType: contentType,
          accept: accept,
          responseType: responseType,
          progressListener: progressListener);

    default:
      throw StateError(
          "Can't handle method: ${EnumToString.convertToString(method)}");
  }
}