Request: Allow specifying middleware only for selected handlers #9
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: go/web#9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Currently middleware doesn't respect the order they are applied.
Both middleware 1 and 2 are applied to both routes.
Ideally only middleware 1 should be applied to the first route, then middleware 1 and 2 for the second route.
Marking this as a feature request because it's the currently intended behavior and not a bug.
For an example of a beautiful interface with this functionality, see https://github.com/go-chi/chi.
I am definitely in favor of this, but I will most likely not have the time to work on it because my other project keeps me busy full-time.
respect middleware orderto Request: Allow specifying middleware only for selected handlersI have working solution with minimal changes.
s.Use()
stil applies global middlewareand for route specific middleware
if your ok with this I will submit a PR
That could work, but is this really the best API we could come up with?
I think we're leaving a better interface on the table.