request method
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,
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)}");
}
}