CaptureMetricsFn wraps w and calls fn with the wrapped w and returns the resulting metrics. This is very similar to CaptureMetrics (which is just sugar on top of this func), but is a more usable interface if your application doesn't use the Go http.Handler interface.
(w http.ResponseWriter, fn func(http.ResponseWriter))
| 35 | // sugar on top of this func), but is a more usable interface if your |
| 36 | // application doesn't use the Go http.Handler interface. |
| 37 | func CaptureMetricsFn(w http.ResponseWriter, fn func(http.ResponseWriter)) Metrics { |
| 38 | m := Metrics{Code: http.StatusOK} |
| 39 | m.CaptureMetrics(w, fn) |
| 40 | return m |
| 41 | } |
| 42 | |
| 43 | // CaptureMetrics wraps w and calls fn with the wrapped w and updates |
| 44 | // Metrics m with the resulting metrics. This is similar to CaptureMetricsFn, |
no test coverage detected
searching dependent graphs…