Skip to content

Commit

Permalink
Fix HandleFunc override in Router
Browse files Browse the repository at this point in the history
  • Loading branch information
szwedm committed Dec 3, 2024
1 parent d82766d commit bb18120
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/httputil/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ func (r *Router) Handle(pattern string, handler http.Handler) {
}

func (r *Router) HandleFunc(pattern string, handleFunc func(http.ResponseWriter, *http.Request)) {
var handler http.Handler
var handler http.Handler = http.HandlerFunc(handleFunc)
for i := len(r.middlewares) - 1; i >= 0; i-- {
handler = r.middlewares[i](http.HandlerFunc(handleFunc))
handler = r.middlewares[i](handler)
}
r.ServeMux.Handle(pattern, handler)
}

0 comments on commit bb18120

Please sign in to comment.