Skip to content
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

Update request type on middleware types #2754

Merged
merged 4 commits into from Jul 9, 2023

Conversation

guacs
Copy link
Contributor

@guacs guacs commented May 17, 2023

Making the Request type generic while keeping it bound to Request on MiddlewareTypes allows users to subclass Sanic's Request class and use that to type hint their middleware functions. Now, when registering those middlewares, the type checkers would not complain.

This resolves #2753

Making the Request type on MiddlewareTypes allows users to subclass Sanic's Request class and use that to type hint their middleware functions. Now, when registering those middlewares, the type checkers would not complain.
@guacs guacs requested a review from a team as a code owner May 17, 2023 04:26
@codecov
Copy link

codecov bot commented May 17, 2023

Codecov Report

Patch coverage: 100.000% and project coverage change: +0.001 🎉

Comparison is base (049983c) 88.919% compared to head (7f06150) 88.920%.

Additional details and impacted files
@@              Coverage Diff              @@
##              main     #2754       +/-   ##
=============================================
+ Coverage   88.919%   88.920%   +0.001%     
=============================================
  Files           92        92               
  Lines         6976      6977        +1     
  Branches      1190      1190               
=============================================
+ Hits          6203      6204        +1     
  Misses         529       529               
  Partials       244       244               
Impacted Files Coverage Δ
sanic/models/handler_types.py 100.000% <100.000%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ahopkins ahopkins merged commit c17230e into sanic-org:main Jul 9, 2023
32 checks passed
@guacs guacs deleted the middleware-request-type branch July 15, 2023 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve type of MiddlewareType
2 participants