Sha256: 164acd9946ee3fe6051c785864a232ac9709000c1e56e382bd2324dec8adb0de
Contents?: true
Size: 770 Bytes
Versions: 6
Compression:
Stored size: 770 Bytes
Contents
# frozen-string-literal: true require 'rack/utils' # class Roda module RodaPlugins # The unescape_path plugin decodes a URL-encoded path # before routing. This fixes routing when the slashes # are URL-encoded as %2f and returns decoded parameters # when matched by symbols or regexps. # # plugin :unescape_path # # route do |r| # # Assume /b/a URL encoded at %2f%62%2f%61 # r.on :x, /(.)/ do |*x| # # x => ['b', 'a'] # end # end module UnescapePath module RequestMethods private # Unescape the path. def _remaining_path(env) Rack::Utils.unescape(super) end end end register_plugin(:unescape_path, UnescapePath) end end
Version data entries
6 entries across 6 versions & 1 rubygems