send<T> method
Sends an HTTP Request.
Implementation
@override
Future<Response<T>> send<T>(Request<T> request) async {
var requestBody = await request.bodyBytes.toBytes();
var bodyBytes = requestBody.toStream();
var response = await _handler(request);
final stringBody = await bodyBytesToString(bodyBytes, response.headers!);
var mimeType = response.headers!.containsKey('content-type')
? response.headers!['content-type']
: '';
final body = bodyDecoded<T>(
request,
stringBody,
mimeType,
);
return Response(
headers: response.headers,
request: request,
statusCode: response.statusCode,
statusText: response.statusText,
bodyBytes: bodyBytes,
body: body,
bodyString: stringBody,
);
}