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

feat(server): allowing to clear middleware #24

Merged
merged 5 commits into from
Jun 21, 2024

Conversation

tatang26
Copy link
Contributor

This MR adds the new ClearMiddleware router method that allows cleaning the router middleware list that is set in the router. This is useful when a router group should not inherit any middleware from its parent.

@tatang26 tatang26 marked this pull request as draft June 21, 2024 19:49
server/mux.go Outdated
mux: http.NewServeMux(),
prefix: "",
mux: http.NewServeMux(),
baseMiddleware: []Middleware{
Copy link
Contributor

@paganotoni paganotoni Jun 21, 2024

Choose a reason for hiding this comment

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

@tatang26 could we have this list of middleware somewhere else?

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean at the package level, so we don't have to carry this on every router.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@paganotoni Sure, I can do this

server/mux.go Outdated
middleware: []Middleware{},
prefix: "",
mux: http.NewServeMux(),
baseMiddleware: baseMiddleware,
Copy link
Contributor

Choose a reason for hiding this comment

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

@tatang26 we don't need this struct field anymore.

Copy link
Contributor

@paganotoni paganotoni left a comment

Choose a reason for hiding this comment

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

Thanks for bearing with me on this one @tatang26

@paganotoni paganotoni marked this pull request as ready for review June 21, 2024 22:39
@paganotoni paganotoni merged commit a67d6fc into leapkit:main Jun 21, 2024
1 check passed
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.

2 participants