-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
GIT-37: fix blueprint middleware application #1690
GIT-37: fix blueprint middleware application #1690
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1690 +/- ##
==========================================
- Coverage 92.09% 92.09% -0.01%
==========================================
Files 22 22
Lines 2215 2238 +23
Branches 411 419 +8
==========================================
+ Hits 2040 2061 +21
Misses 137 137
- Partials 38 40 +2
Continue to review full report at Codecov.
|
@huge-success/sanic-core-devs Can you please take a look at this PR and see if this looks good? We can close a pretty old issue with this one. |
@harshanarayana do we need to add test to prevent reversions for this behavior? |
Existing tests have been modified to assert new behavior. So any change in this behavior again will cause those tests to fail. Do you happen to have any specific scenario in mind that I may have missed ? |
1. If you register a middleware via `@blueprint.middleware` then it will apply only to the routes defined by the blueprint. 2. If you register a middleware via `@blueprint_group.middleware` then it will apply to all blueprint based routes that are part of the group. 3. If you define a middleware via `@app.middleware` then it will be applied on all available routes Fixes sanic-org#37 Signed-off-by: Harsha Narayana <[email protected]>
Signed-off-by: Harsha Narayana <[email protected]>
9122019
to
008e9e9
Compare
@huge-success/sanic-core-devs Can we get this one into the next release ? This is sort of a breaking change but in the right direction |
cc @huge-success/sanic-core-devs |
I've approved it. I'm going to add a note on sanicframework.org and figure out how to call it out in the generated release notes before merging. |
@sjsadowski This can be done easily. I've added a command |
@harshanarayana awesome! |
@blueprint.middleware
then it will apply only to the routes defined by the blueprint.@blueprint_group.middleware
then it will apply to all blueprint based routes that are part of the group.@app.middleware
then it will be applied on all available routesFixes #37