send method
Sends the request
to the given uri
.
Implementation
Future<Response> send(Uri uri, Request request) async {
final body = await _encode(request.document);
final response = await _http.handle(HttpRequest(
request.method,
request.query.isEmpty
? uri
: uri.replace(queryParameters: request.query),
body: body)
..headers.addAll({
'Accept': mediaType,
if (body.isNotEmpty) 'Content-Type': mediaType,
...request.headers
}));
final document = await _decode(response);
return Response(response, document);
}