module Roda::RodaPlugins::Middleware::InstanceMethods

  1. lib/roda/plugins/middleware.rb

Methods

Public Instance

  1. _roda_run_main_route
  2. call

Public Instance methods

_roda_run_main_route(r)

Override the route block so that if no route matches, we throw so that the next middleware is called.

[show source]
    # File lib/roda/plugins/middleware.rb
204 def _roda_run_main_route(r)
205   res = super
206   if r.forward_next
207     r.env['roda.response_headers'] = response.headers if opts[:middleware_forward_response_headers]
208     throw :next, true
209   end
210   res
211 end
call(&block)

Override the route block so that if no route matches, we throw so that the next middleware is called. Old Dispatch API.

[show source]
    # File lib/roda/plugins/middleware.rb
191 def call(&block)
192   super do |r|
193     res = instance_exec(r, &block) # call Fallback
194     if r.forward_next
195       r.env['roda.response_headers'] = response.headers if opts[:middleware_forward_response_headers]
196       throw :next, true
197     end
198     res
199   end
200 end