Pipeline pipeActual(Iterable<Middleware> middleware)

Source

Pipeline pipeActual(Iterable<shelf.Middleware> middleware) {
  final shelf.Pipeline pipe = middleware.fold/*<shelf.Pipeline>*/(
      const shelf.Pipeline(),
      (shelf.Pipeline pipeline, shelf.Middleware middleware) {
    return pipeline.addMiddleware(middleware);
  });
  final shelf.Handler handler = pipe.addHandler((Request request) {
    throw new NoResponseFromPipelineException();
  });

  Future<Response> pipeline(Request request) async => handler(request);
  return pipeline;
}