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
205 def _roda_run_main_route(r)
206   res = super
207   if r.forward_next
208     r.env['roda.response_headers'] = response.headers if opts[:middleware_forward_response_headers]
209     throw :next, true
210   end
211   res
212 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
192 def call(&block)
193   super do |r|
194     res = instance_exec(r, &block) # call Fallback
195     if r.forward_next
196       r.env['roda.response_headers'] = response.headers if opts[:middleware_forward_response_headers]
197       throw :next, true
198     end
199     res
200   end
201 end