-
-
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
Modify the priority of :any routes, fixes #1089 #1517
Conversation
@@ -755,9 +786,6 @@ class DummyFormatClass | |||
subject.post :example do | |||
'example' | |||
end | |||
subject.route :any, '*path' do | |||
error! :not_found, 404 | |||
end |
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 route is incorrect now.
@dblock I think we should add the explanation about this into UPGRADING.md, right? |
@@ -12,6 +12,7 @@ Next Release | |||
#### Fixes | |||
|
|||
* [#1505](https://github.com/ruby-grape/grape/pull/1505): Run `before` and `after` callbacks, but skip the rest when handling OPTIONS - [@jlfaber](https://github.com/jlfaber). | |||
* [#1517](https://github.com/ruby-grape/grape/pull/1517): Modify the priority of ANY routes, fixes #1089 - [@namusyaka](https://github.com/namusyaka), [@wagenet](https://github.com/wagenet) |
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.
Missing a period at the end :) and I would do [#1517](...), [#1089]() ...:
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.
omg, thanks :)
@@ -19,6 +19,10 @@ def self.normalize_path(path) | |||
path | |||
end | |||
|
|||
def self.supported_methods | |||
@supported_methods ||= Grape::Http::Headers::SUPPORTED_METHODS + ['ANY'] |
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 *
instead of ANY
? Just in case ANY
one day becomes an HTTP verb :)
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.
Got it.
Definitely needs a note in UPGRADING. Thanks! |
@dblock Could you review this again? |
@@ -12,6 +12,7 @@ Next Release | |||
#### Fixes | |||
|
|||
* [#1505](https://github.com/ruby-grape/grape/pull/1505): Run `before` and `after` callbacks, but skip the rest when handling OPTIONS - [@jlfaber](https://github.com/jlfaber). | |||
* [#1517](https://github.com/ruby-grape/grape/pull/1517): Modify the priority of ANY routes, fixes #1089 - [@namusyaka](https://github.com/namusyaka), [@wagenet](https://github.com/wagenet). |
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.
Should be:
[#1517](https://github.com/ruby-grape/grape/pull/1517), [#1089](https://github.com/ruby-grape/grape/pull/1089): Fix: priority of ANY routes - [@namusyaka](https://github.com/namusyaka), [@wagenet](https://github.com/wagenet).
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.
Okay, fixed.
I corrected some English and merged via e489995. Thank you. |
@dblock Thanks! |
end | ||
end | ||
|
||
send('get', 'nested') |
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.
Just noticing this. This should just be get 'nested/something'
..., I'll update.
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.
Right. I missed this. Sorry ;(
ref #1089
Conventional, the :any routes had been searched after matching first route and 405 routes.
This PR fixes the issue by adding the :any routes processing before 405 processing.