toBaseRequest method

Future<Abortable> toBaseRequest()

Converts this Chopper Request into a http.Abortable.

All parameters and headers are conserved.

Depending on the request type the returning object will be:

  • http.AbortableStreamedRequest if body is a Stream<List<int>>
  • http.AbortableMultipartRequest if multipart is true
  • or a http.AbortableRequest

Implementation

Future<http.Abortable> toBaseRequest() async {
  if (body is Stream<List<int>>) return toStreamedRequest(body);

  if (multipart) return toMultipartRequest();

  return toHttpRequest();
}