Module: Roda::RodaPlugins::RunAppendSlash::RequestMethods
- Defined in:
- lib/roda/plugins/run_append_slash.rb
Instance Method Summary collapse
-
#run ⇒ Object
Calls the given rack app.
Instance Method Details
#run ⇒ Object
Calls the given rack app. If the path matches the root of the app but
does not contain a trailing slash, a trailing slash is appended to the
path internally, or a redirect is issued when configured with
use_redirects: true. If the path starts with //,
the redirect approach will not be used.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/roda/plugins/run_append_slash.rb', line 40 def run(*) if @remaining_path.empty? if scope.opts[:run_append_slash_redirect] && !(path = self.path).start_with?('//') redirect("#{path}/") else @remaining_path += '/' end end super end |