net/http2: fix erringRoundTripper

The http transport added a new interface to detect RoundTrippers that
always error. Prior to this, the erringRoundTripper would not be
identified as such and a new connection was always created.

Updates golang/go#40213

Change-Id: Icc315dcc9ce8ea0db94a1f2c58c6a741675d8962
Reviewed-by: Chris Friesen <>
Reviewed-by: Emmanuel Odeke <>
Run-TryBot: Emmanuel Odeke <>
TryBot-Result: Gobot Gobot <>
diff --git a/http2/transport.go b/http2/transport.go
index 76a92e0..2482f7b 100644
--- a/http2/transport.go
+++ b/http2/transport.go
@@ -2525,6 +2525,7 @@
 type erringRoundTripper struct{ err error }
+func (rt erringRoundTripper) RoundTripErr() error                             { return rt.err }
 func (rt erringRoundTripper) RoundTrip(*http.Request) (*http.Response, error) { return nil, rt.err }
 // gzipReader wraps a response body so it can lazily