-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make versioner consider the mount destination path #1570
Conversation
lib/grape/endpoint.rb
Outdated
@@ -295,7 +295,8 @@ def build_stack(helpers) | |||
stack.use Grape::Middleware::Versioner.using(namespace_inheritable(:version_options)[:using]), | |||
versions: namespace_inheritable(:version) ? namespace_inheritable(:version).flatten : nil, | |||
version_options: namespace_inheritable(:version_options), | |||
prefix: namespace_inheritable(:root_prefix) | |||
prefix: namespace_inheritable(:root_prefix), | |||
mount_path: namespace_stackable(:mount_path)[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe .first
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
@@ -25,6 +25,7 @@ def default_options | |||
|
|||
def before | |||
path = env[Grape::Http::Headers::PATH_INFO].dup | |||
path.sub!(mount_path, '') if mount_path && path.start_with?(mount_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems dangerous, like foo
vs. foobar
, one starts with another.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I have just force-pushed changes
@dblock Could you confirmed current changes? |
9 similar comments
Looks good. |
Fixes #636
If my perception is correct, it is enough that only this changes is enough.
@dblock Thoughts?