Closed
Description
Proposal: add a context-aware handler interface that is similar to/mirrors http.Handler
and http.HandlerFunc
type Handler interface {
ServeHTTP(context.Context, http.ResponseWriter, *http.Request)
}
type HandlerFunc func(context.Context, http.ResponseWriter, *http.Request)
// ServeHTTP calls f(w, r).
func (f HandlerFunc) ServeHTTP(c context.Context, w http.ResponseWriter, r *http.Request) {
f(c, w, r)
}
In the future, we’d also want to add a ServerMux that implements the above interface. Thoughts?