module Roda::RodaPlugins::Middleware::InstanceMethods

def _roda_run_main_route(r)

that the next middleware is called.
Override the route block so that if no route matches, we throw so
def _roda_run_main_route(r)
  res = super
  if r.forward_next
    r.env['roda.response_headers'] = response.headers if opts[:middleware_forward_response_headers]
    throw :next, true
  end
  res
end

def call(&block)

that the next middleware is called. Old Dispatch API.
Override the route block so that if no route matches, we throw so
def call(&block)
  super do |r|
    res = instance_exec(r, &block) # call Fallback
    if r.forward_next
      r.env['roda.response_headers'] = response.headers if opts[:middleware_forward_response_headers]
      throw :next, true
    end
    res
  end
end