encodeRequest method
Used to encode the body of the request before sending it.
Implementation
Future<Request> encodeRequest(Request request) async {
var converted = (await converter?.encode(request));
if (converted == null && request.body is JsonSerializable) {
converted = await jsonConverter.encode(request);
}
if (converted == null) {
throw new Exception(
"No converter found for type ${request.body?.runtimeType}");
}
return converted;
}