lib/roda/plugins/middleware.rb in roda-3.17.0 vs lib/roda/plugins/middleware.rb in roda-3.18.0
- old
+ new
@@ -125,18 +125,28 @@
super
else
Forwarder.new(self, app, *args, &block)
end
end
+ end
+ module InstanceMethods
# Override the route block so that if no route matches, we throw so
- # that the next middleware is called.
- def route(*args, &block)
+ # that the next middleware is called. Old Dispatch API.
+ def call(&block)
super do |r|
- res = instance_exec(r, &block)
+ res = instance_exec(r, &block) # call Fallback
throw :next, true if r.forward_next
res
end
+ end
+
+ # Override the route block so that if no route matches, we throw so
+ # that the next middleware is called.
+ def _roda_run_main_route(r)
+ res = super
+ throw :next, true if r.forward_next
+ res
end
end
module RequestMethods
# Whether to forward the request to the next application. Set only if