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