-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
server/mux.go
Outdated
mux: http.NewServeMux(), | ||
prefix: "", | ||
mux: http.NewServeMux(), | ||
baseMiddleware: []Middleware{ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
There was a problem hiding this 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
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.