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
40 def run(*)
41   if @remaining_path.empty?
42     if scope.opts[:run_append_slash_redirect] && !(path = self.path).start_with?('//')
43       redirect("#{path}/")
44     else
45       @remaining_path += '/'
46     end
47   end
48   super
49 end