-
Notifications
You must be signed in to change notification settings - Fork 102
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
Class routes: interpret optional parameters #37
Comments
Could you create a test for this in a separate branch? |
For the both cases the route didn't match. I greated the both tests on my fork and both tests fail:
|
This is actually a known issue. I've discussed this with @augustohp a couple of weeks ago. If you declare more than one parameter (like I'm not sure if we should drop optional parameters at all (it is easy to achieve the same result declaring more routes) or fix this. The fix may be complex 'cause this part of the implementation is very sensitive (regex translation). Documentation also needs to be improved. I'm gonna work on this today or tomorrow depending on my time windows. |
@pablolmiranda: In the mean time, there still a way to work with this. Register two routes to the same class/closure, like this:
This works since we already use that in some enviroments. Let us know if this works for you. ;) |
I believe this is fixed for now! @pablolmiranda I've pulled your test cases from your repo and commited them. It should be working for any route with any number of optional parameters (as long as they're at the end of the route). I'm closing the issue, if the problem persists please let me know. |
When you register a route, you can have optional parameters, like
/users/*
, if you declare in the function that the parameter is optional, than if none is given the route matches and is dispatched. This doesn't happen with classes used as routes. #sadpandaThe text was updated successfully, but these errors were encountered: