module Roda::RodaPlugins::RunAppendSlash::RequestMethods

  1. lib/roda/plugins/run_append_slash.rb

Methods

Public Instance

  1. run

Public Instance methods

run(*)

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.

[show source]
   # File lib/roda/plugins/run_append_slash.rb
44 def run(*)
45   if @remaining_path.empty?
46     if roda_class.run_append_slash_redirect? && !(path = self.path).start_with?('//')
47       redirect("#{path}/")
48     else
49       @remaining_path += '/'
50     end
51   end
52   super
53 end