Module: Roda::RodaPlugins::RunAppendSlash::RequestMethods

Defined in:
lib/roda/plugins/run_append_slash.rb

Instance Method Summary collapse

Instance Method Details

#runObject

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.



36
37
38
39
40
41
42
43
44
45
# File 'lib/roda/plugins/run_append_slash.rb', line 36

def run(*)
  if @remaining_path.empty?
    if scope.opts[:run_append_slash_redirect]
      redirect("#{path}/")
    else
      @remaining_path += '/'
    end
  end
  super
end