Open mitar opened 2 years ago
I think it might be useful to switch mutil.WrapWriter
to https://github.com/felixge/httpsnoop.
It looks trivial to replace it:
func AccessHandler(f func(req *http.Request, code int, size int64, duration time.Duration)) func(next http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
m := httpsnoop.CaptureMetrics(next, w, req)
f(req, m.Code, m.Written, m.Duration)
})
}
}
Because
w.(http.Pusher)
fails. It looks likemutil.WrapWriter
does not implement it.