def build_request_chain(sequence, context)
      sequence.reverse.reduce(nil) do |successor, item|
        item.build_middleware(context, successor)
      end
    end
def build_request_chain(sequence, context)
      sequence.reverse.reduce(nil) do |successor, item|
        item.build_middleware(context, successor)
      end
    end
Given a middleware sequence, filter out items not applicable to the
 current request, and set up a chain of instantiated middleware objects,
 ready to serve a request.