Skip to content

Commit f88e0d3

Browse files
committed
Merge pull request #64 from lhigueragamboa/simplify_handler_func
router: Reuse Handler method in HandlerFunc
2 parents b428fda + 69041da commit f88e0d3

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

router.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,7 @@ func (r *Router) Handler(method, path string, handler http.Handler) {
237237
// HandlerFunc is an adapter which allows the usage of an http.HandlerFunc as a
238238
// request handle.
239239
func (r *Router) HandlerFunc(method, path string, handler http.HandlerFunc) {
240-
r.Handle(method, path,
241-
func(w http.ResponseWriter, req *http.Request, _ Params) {
242-
handler(w, req)
243-
},
244-
)
240+
r.Handler(method, path, handler)
245241
}
246242

247243
// ServeFiles serves files from the given file system root.

0 commit comments

Comments
 (0)