Sha256: 581738b8da67ae6b46249b8e8d4c52d3f2f6e6167ec81a765f4b505f82bde8b2
Contents?: true
Size: 595 Bytes
Versions: 3
Compression:
Stored size: 595 Bytes
Contents
module RouteDowncaser class DowncaseRouteMiddleware def initialize(app) @app = app end def call(env) if env['REQUEST_URI'] uri_items = env['REQUEST_URI'].split('?') uri_items[0].downcase! env['REQUEST_URI'] = uri_items.join('?') end if env['PATH_INFO'] =~ /assets\//i pieces = env['PATH_INFO'].split('/') env['PATH_INFO'] = pieces.slice(0..-2).join('/').downcase + '/' + pieces.last elsif env['PATH_INFO'] env['PATH_INFO'] = env['PATH_INFO'].downcase end @app.call(env) end end end
Version data entries
3 entries across 3 versions & 1 rubygems