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
157 def _roda_run_main_route(r)
158   res = super
159   if r.forward_next
160     r.env['roda.response_headers'] = response.headers if opts[:middleware_forward_response_headers]
161     throw :next, true
162   end
163   res
164 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
144 def call(&block)
145   super do |r|
146     res = instance_exec(r, &block) # call Fallback
147     if r.forward_next
148       r.env['roda.response_headers'] = response.headers if opts[:middleware_forward_response_headers]
149       throw :next, true
150     end
151     res
152   end
153 end