send method
Sends an HTTP request through the middleware chain.
The request is processed by all registered middleware before being sent by the underlying client.
request The HTTP request to send.
Returns a Future that resolves to the HTTP response.
Implementation
@override
Future<http.StreamedResponse> send(http.BaseRequest request) {
final chain = _middlewares.reversed
.fold<Future<http.StreamedResponse> Function(http.BaseRequest)>(
_inner.send,
(next, middleware) =>
(req) => middleware(req, next),
);
return chain(request);
}