-
Notifications
You must be signed in to change notification settings - Fork 448
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
Match routes strictly in order of definition (?) #97
Comments
@nikic Can you or the one who suggested this elaborate a bit more on why this may be preferable? |
I'm not 100% sure that I fully understand the points on discussion, but I'd say that if it matches 2 or more routes, it should either send an error, or send the list of matched routes and let the application decide the behavior. It shouldn't just fail silently and return the route that was the first to be defined. |
@Manhim That it matches two routes is pretty normal, e.g. |
|
@Trainmaster The idea is to make the matching conceptually simpler (though the matching logic will be more complicated). Doing it this way would allow you to explain how routes are matched by just saying "in order of definition" and that's it. The current behavior has been unfavorably compared to the impenetrable CSS specificity rules ;) @Manhim As Bob pointed out, it is very common to have multiple matching routes for a URL, typically some static route and a more general dynamic route. This is not an exceptional condition, it is perfectly ordinary. I don't think it would help anyone to return multiple routes in this case. The developer can decide which route will be returned based on the definition order (and we have warnings in place to catch obviously wrong ordering). |
Currently the router uses a three tier fallback system:
*
method routes.It has been suggested that it may be preferable to avoid this kind of fallback behavior and instead match routes strictly in the order in which they were defined.
The text was updated successfully, but these errors were encountered: