Module: Roda::RodaPlugins::Middleware::InstanceMethods
- Defined in:
- lib/roda/plugins/middleware.rb
Instance Method Summary collapse
-
#_roda_run_main_route(r) ⇒ Object
Override the route block so that if no route matches, we throw so that the next middleware is called.
-
#call(&block) ⇒ Object
Override the route block so that if no route matches, we throw so that the next middleware is called.
Instance Method Details
#_roda_run_main_route(r) ⇒ Object
Override the route block so that if no route matches, we throw so that the next middleware is called.
205 206 207 208 209 210 211 212 |
# File 'lib/roda/plugins/middleware.rb', line 205 def _roda_run_main_route(r) res = super if r.forward_next r.env['roda.response_headers'] = response.headers if opts[:middleware_forward_response_headers] throw :next, true end res end |
#call(&block) ⇒ Object
Override the route block so that if no route matches, we throw so that the next middleware is called. Old Dispatch API.
192 193 194 195 196 197 198 199 200 201 |
# File 'lib/roda/plugins/middleware.rb', line 192 def call(&block) super do |r| res = instance_exec(r, &block) # call Fallback if r.forward_next r.env['roda.response_headers'] = response.headers if opts[:middleware_forward_response_headers] throw :next, true end res end end |