Class: BetterAuth::Grape::MountedApp
- Inherits:
-
Object
- Object
- BetterAuth::Grape::MountedApp
- Defined in:
- lib/better_auth/grape/mounted_app.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(auth, mount_path:) ⇒ MountedApp
constructor
A new instance of MountedApp.
Constructor Details
#initialize(auth, mount_path:) ⇒ MountedApp
Returns a new instance of MountedApp.
8 9 10 11 |
# File 'lib/better_auth/grape/mounted_app.rb', line 8 def initialize(auth, mount_path:) @auth = auth @mount_path = normalize_path(mount_path) end |
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/better_auth/grape/mounted_app.rb', line 13 def call(env) rewritten_path = mounted_path_info(env) next_env = env.merge("PATH_INFO" => rewritten_path) next_env["SCRIPT_NAME"] = "" if shared_mount_rewrite?(env, rewritten_path) @auth.call(next_env) rescue BetterAuth::APIError, JSON::ParserError raise rescue => error handle_unexpected_error(error, env) end |