How httpsnoop handles ResponseWriter interfaces
masterA common mistake when instrumenting http.Handler is naive wrapping of http.ResponseWriter, which hides optional interfaces like http.Flusher, http.CloseNotifier, http.Hijacker, http.Pusher, and io.ReaderFrom. This can break applications that rely on these interfaces.
httpsnoop solves this by detecting which additional interfaces the original http.ResponseWriter implements and returning a wrapped version that implements that exact same set of interfaces. This ensures compatibility with non-trivial applications while still allowing metric capture.