WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Using mount adds trailing slash #290

@ahx

Description

@ahx

This is the code that I am using to debug this:

# config.ru
Router = Hanami::Router.new do
  mount ->(env) { binding.irb }, at: '/settings'
end

run Router

When making a request GET /settings the rack env includes these values:

"SCRIPT_NAME" => "/settings",
"PATH_INFO" => "/"

Put together this ends up with the request path "/settings/" instead of "/settings" as in the original request.

For me this is a problem, because I am trying to map the request to a path in an OpenAPI definition and that one just knows about "/settings" not "/settings/". Also this was quite surprising to see that there seems to be no way to get to the original request path (without trailing slash in this case) when using hanami-router's mount or scope (not sure about scope).

To me this looks like a bug. Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions