Skip to content

Commit

Permalink
fix: typings
Browse files Browse the repository at this point in the history
  • Loading branch information
ConsoleTVs committed Apr 3, 2024
1 parent 521f76d commit f830d00
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ func (handler Handler) ServeHTTP(writer http.ResponseWriter, request *http.Reque
handleError(writer, request, handler(request))
}

func HandlerFunc(handler Handler) http.HandlerFunc {
func (handler Handler) HandlerFunc() http.HandlerFunc {
return http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
handleError(writer, request, handler(request))
handler.ServeHTTP(writer, request)
})
}

func HandlerFunc(handler func(*http.Request) error) http.HandlerFunc {
return Handler(handler).HandlerFunc()
}

0 comments on commit f830d00

Please sign in to comment.