Sha256: fb435a22f538f6e095ec5304718c2de140fbf209b15a6fa565f3b3303f5b0084
Contents?: true
Size: 721 Bytes
Versions: 5
Compression:
Stored size: 721 Bytes
Contents
# frozen_string_literal: true module Hanami class Router class MountedPath def initialize(prefix, app) @prefix = prefix @app = app end def endpoint_and_params(env) return [] unless (match = @prefix.peek_match(env[::Rack::PATH_INFO])) if @prefix.to_s == "/" env[::Rack::SCRIPT_NAME] = EMPTY_STRING else env[::Rack::SCRIPT_NAME] = env[::Rack::SCRIPT_NAME].to_s + @prefix.to_s env[::Rack::PATH_INFO] = env[::Rack::PATH_INFO].sub(@prefix.to_s, EMPTY_STRING) env[::Rack::PATH_INFO] = DEFAULT_PREFIX if env[::Rack::PATH_INFO] == EMPTY_STRING end [@app, match.named_captures] end end end end
Version data entries
5 entries across 5 versions & 1 rubygems