-
-
Notifications
You must be signed in to change notification settings - Fork 835
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
Refactor Route Resolving and Dispatch #2425
Refactor Route Resolving and Dispatch #2425
Conversation
This allows us to run middleware after we figure out which route we're on, but before we actually execute the controller for that route.
By making the route name explicitly available to middlewares, applications like CSRF and floodgate can set patterns based on route names instead of the path, which is an implementation detail.
- For these changes to actually be useful, we need to process ResolveRoute before ExecuteRoute, with the ability for people to add things in between - We can also now add all middleware to the stack the same way, increasing extensibility.
Otherwise, `add`in the MiddlewareExtender doesn't work since it adds it after ExecuteRoute, which doesn't do anything.
[ci skip] [skip ci]
Doesn't the order of the middlewares cause the "not found" / "invalid method" error pages to not be translated into the user-selected language? Since |
Ah didn't think of that case, pushed a fix. RequireAdministrativeAbility and ShareErrorsFromSession should be fine after route resolver, I think? |
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.
@askvortsov1 RequireAdministrativeAbility and ShareErrorsFromSession should be fine after route resolver, I think?
I think this should be fine the way it is, but haven't done any test on this PR.
…sed on routes, not paths. Deprecate the old method.
[ci skip] [skip ci]
Prep for #2170
Changes proposed in this pull request:
RouteCollection
has been changed to return the route name as well as the handler functionReviewers should focus on:
Confirmed
composer test
).