-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Method wildcard option does not work #1212
Comments
Not seeing it. |
This must be the missing piece.
An explicit GET handler exists generically and is given precedence. Makes more sense now but seems less usable as the GET handler needs to go to * or need to expand out the log handler for each method that needs to be supported. |
Literal verbs get precedence over wildcards: https://github.com/spumko/hapi/blob/master/lib/router.js#L49-L56 I agree this is not ideal but not sure how to adjust it. Going back and forth between wildcard and verb-specific will degrade performance for the much more common use cases. It will require looking in both tables and if two matches found, comparing their paths for the more specific one. I am inclined to simply document this and suggest you avoid using '*', but instead explicitly add the routes you need. |
I think that is fair if documented. Would you consider allowing an array of methods for the method parameter? Effectively would be syntax sugar for whatever construct that you would need to do to otherwise reduce code duplication if you need to support multiple methods for the same route and handler. I.e.
|
Done. |
Returns a 404 error when curled.
The text was updated successfully, but these errors were encountered: