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

Add middleware per Router #2351

Merged
merged 3 commits into from
Dec 1, 2023
Merged

Add middleware per Router #2351

merged 3 commits into from
Dec 1, 2023

Conversation

Kludex
Copy link
Sponsor Member

@Kludex Kludex commented Nov 28, 2023

No description provided.

@@ -650,6 +652,11 @@ def __init__(
else:
self.lifespan_context = lifespan

self.middleware_stack = self.app
Copy link
Sponsor Member Author

@Kludex Kludex Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you'll comment about the names, but I prefer them.

@Kludex Kludex requested a review from a team November 30, 2023 13:03
Copy link

@iudeen iudeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Do we need to update docs?

@Kludex
Copy link
Sponsor Member Author

Kludex commented Dec 1, 2023

@encode/maintainers someone else wants to review this?

@Kludex Kludex mentioned this pull request Dec 1, 2023
4 tasks
@@ -615,6 +615,8 @@ def __init__(
# the generic to Lifespan[AppType] is the type of the top level application
# which the router cannot know statically, so we use typing.Any
lifespan: typing.Optional[Lifespan[typing.Any]] = None,
*,
middleware: typing.Optional[typing.Sequence[Middleware]] = None,
Copy link
Member

@abersheeran abersheeran Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use name middlewares?

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we use middleware everywhere already...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂 Oh, I didn't even notice that.

Copy link
Member

@abersheeran abersheeran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple and elegant modification

@Kludex Kludex enabled auto-merge (squash) December 1, 2023 12:56
@Kludex Kludex merged commit 811dacc into master Dec 1, 2023
5 checks passed
@Kludex Kludex deleted the middleware-per-router branch December 1, 2023 12:58
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.

3 participants