Skip to content

Add middleware per Router#2351

Merged
Kludex merged 3 commits intomasterfrom
middleware-per-router
Dec 1, 2023
Merged

Add middleware per Router#2351
Kludex merged 3 commits intomasterfrom
middleware-per-router

Conversation

@Kludex
Copy link
Owner

@Kludex Kludex commented Nov 28, 2023

No description provided.

else:
self.lifespan_context = lifespan

self.middleware_stack = self.app
Copy link
Owner 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
Contributor

@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 Kludex force-pushed the middleware-per-router branch from de102eb to 11d5b8c Compare December 1, 2023 10:53
@Kludex
Copy link
Owner 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
# 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
Contributor

@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
Owner 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
Contributor

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
Contributor

@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
@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