Module: Roda::RodaPlugins::RunHandler::RequestMethods
- Defined in:
- lib/roda/plugins/run_handler.rb
Instance Method Summary collapse
-
#run(app, opts = OPTS) {|res| ... } ⇒ Object
If a block is given, yield the rack response array to it.
Instance Method Details
#run(app, opts = OPTS) {|res| ... } ⇒ Object
If a block is given, yield the rack response array to it. The response can be modified before it is returned by the current app.
If the not_found: :pass
option is given, and the rack response returned by the app is a 404 response, do not return the response, continue routing normally.
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/roda/plugins/run_handler.rb', line 35 def run(app, opts=OPTS) res = catch(:halt){super(app)} yield res if defined?(yield) if opts[:not_found] == :pass && res[0] == 404 body = res[2] body.close if body.respond_to?(:close) nil else throw(:halt, res) end end |