go-stdlib icon indicating copy to clipboard operation
go-stdlib copied to clipboard

Make metricsTracker implement Unwrap method.

Open pstibrany opened this issue 1 year ago • 0 comments

New https://pkg.go.dev/net/http#ResponseController introduced in Go 1.20 uses Unwrap method on http.ResponseWriter implementations to get access to original http.ResponseWriter or underlying connection.

This PR adds Unwrap method to *nethttp.metricsTracker, which is a single implementation of http.ResponseWriter in this library. This makes it possible to use new http.ResponseController with responses wrapped by this library.

Note that metricsTracker implementation is based on httpsnoop, which now also supports Unwrap method: https://github.com/felixge/httpsnoop/issues/8.

pstibrany avatar May 09 '23 07:05 pstibrany