toBaseRequest method

Future<BaseRequest> toBaseRequest()

Converts this Chopper Request into a http.BaseRequest.

All parameters and headers are conserved.

Depending on the request type the returning object will be:

Implementation

Future<http.BaseRequest> toBaseRequest() async {
  final uri = _buildUri();
  final heads = _buildHeaders();

  if (body is Stream<List<int>>) {
    return toStreamedRequest(
      body,
      method,
      uri,
      heads,
    );
  }

  if (multipart) {
    return toMultipartRequest(
      parts,
      method,
      uri,
      heads,
    );
  }
  return toHttpRequest(
    body,
    method,
    uri,
    heads,
  );
}