ServeMux.HandleFunc: Take a HandlerFunc argument
This commit is contained in:
parent
5ab7617efd
commit
4e25d2c3f9
7
mux.go
7
mux.go
@ -294,9 +294,6 @@ func appendSorted(es []muxEntry, e muxEntry) []muxEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// HandleFunc registers the handler function for the given pattern.
|
// HandleFunc registers the handler function for the given pattern.
|
||||||
func (mux *ServeMux) HandleFunc(pattern string, handler func(context.Context, ResponseWriter, *Request)) {
|
func (mux *ServeMux) HandleFunc(pattern string, handler HandlerFunc) {
|
||||||
if handler == nil {
|
mux.Handle(pattern, handler)
|
||||||
panic("gemini: nil handler")
|
|
||||||
}
|
|
||||||
mux.Handle(pattern, HandlerFunc(handler))
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user