Skip to content
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

Closed
wants to merge 3 commits into from
Closed

Conversation

namusyaka
Copy link
Contributor

@namusyaka namusyaka commented Nov 5, 2016

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.

@@ -755,9 +786,6 @@ class DummyFormatClass
subject.post :example do
'example'
end
subject.route :any, '*path' do
error! :not_found, 404
end
Copy link
Contributor Author

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.

@namusyaka
Copy link
Contributor Author

@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)
Copy link
Member

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]() ...:

Copy link
Contributor Author

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']
Copy link
Member

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 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

@dblock
Copy link
Member

dblock commented Nov 5, 2016

Definitely needs a note in UPGRADING. Thanks!

@namusyaka
Copy link
Contributor Author

@dblock Could you review this again?

@namusyaka namusyaka changed the title Modify the priority of ANY routes, fixes #1089 Modify the priority of :any routes, fixes #1089 Nov 6, 2016
@@ -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).
Copy link
Member

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).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, fixed.

@dblock
Copy link
Member

dblock commented Nov 6, 2016

I corrected some English and merged via e489995. Thank you.

@dblock dblock closed this Nov 6, 2016
@namusyaka
Copy link
Contributor Author

@dblock Thanks!

end
end

send('get', 'nested')
Copy link
Member

@dblock dblock Nov 6, 2016

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.

Copy link
Contributor Author

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 ;(

@namusyaka namusyaka deleted the fix-1089 branch November 12, 2016 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants