lib/roda/plugins/path_rewriter.rb in roda-2.27.0 vs lib/roda/plugins/path_rewriter.rb in roda-2.28.0

- old
+ new

@@ -43,13 +43,15 @@ # # All path rewrites are applied in order, so if a path is rewritten by one rewrite, # it can be rewritten again by a later rewrite. Note that PATH_INFO rewrites are # processed before remaining_path rewrites. module PathRewriter - PATH_INFO = 'PATH_INFO'.freeze OPTS={}.freeze + PATH_INFO = 'PATH_INFO'.freeze + RodaPlugins.deprecate_constant(self, :PATH_INFO) + def self.configure(app) app.instance_exec do app.opts[:remaining_path_rewrites] ||= [] app.opts[:path_info_rewrites] ||= [] end @@ -84,10 +86,10 @@ end module RequestMethods # Rewrite remaining_path and/or PATH_INFO based on the path rewrites. def initialize(scope, env) - path_info = env[PATH_INFO] + path_info = env['PATH_INFO'] rewrite_path(scope.class.opts[:path_info_rewrites], path_info) super remaining_path = @remaining_path = @remaining_path.dup rewrite_path(scope.class.opts[:remaining_path_rewrites], remaining_path)