Class: BetterAuth::Hanami::MountedApp

Inherits:
Object
  • Object
show all
Defined in:
lib/better_auth/hanami/mounted_app.rb

Overview

Rewrites PATH_INFO so the core router sees paths under mount_path. Hanami’s Slice::Router passes PATH_INFO as exercised in routing specs; custom Rack mounts that differ from that contract may need app-level rewriting adjustments. Compare the Rails adapter when debugging path behavior involving SCRIPT_NAME.

Instance Method Summary collapse

Constructor Details

#initialize(auth, mount_path:) ⇒ MountedApp

Returns a new instance of MountedApp.



11
12
13
14
# File 'lib/better_auth/hanami/mounted_app.rb', line 11

def initialize(auth, mount_path:)
  @auth = auth
  @mount_path = normalize_path(mount_path)
end

Instance Method Details

#call(env) ⇒ Object



16
17
18
# File 'lib/better_auth/hanami/mounted_app.rb', line 16

def call(env)
  @auth.call(env.merge("PATH_INFO" => mounted_path_info(env)))
end