request method
Future<Response>
request(
- String method,
- String path, {
- QueryMap? query,
- Object? body,
- Object? json,
- RequestOptions? options,
- ProgressCallback? onSendProgress,
- ProgressCallback? onReceiveProgress,
})
Implementation
Future<Response> request(
String method,
String path, {
QueryMap? query,
HeadersInit? headers,
Object? body,
Object? json,
RequestOptions? options,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) {
final requestHeaders = Headers(headers);
final requestBody = _normalizeBody(
body: body,
json: json,
headers: requestHeaders,
);
final nextOptions = (options ?? const RequestOptions()).copyWith(
query: query,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
return send(
Request(
path,
RequestInit(
method: HttpMethod.parse(method),
headers: requestHeaders,
body: requestBody,
),
),
options: nextOptions,
);
}