@@ -166,7 +166,10 @@ func TestWithProxyTransport_HTTPProxy(t *testing.T) {
166166 t .Fatalf ("GET through http proxy: %v" , err )
167167 }
168168 defer resp .Body .Close ()
169- body , _ := io .ReadAll (resp .Body )
169+ body , err := io .ReadAll (resp .Body )
170+ if err != nil {
171+ t .Fatalf ("read body: %v" , err )
172+ }
170173
171174 if resp .StatusCode != http .StatusOK {
172175 t .Errorf ("expected 200, got %d" , resp .StatusCode )
@@ -198,7 +201,10 @@ func TestWithProxyTransport_HTTPSProxy(t *testing.T) {
198201 t .Fatalf ("GET through https proxy: %v" , err )
199202 }
200203 defer resp .Body .Close ()
201- body , _ := io .ReadAll (resp .Body )
204+ body , err := io .ReadAll (resp .Body )
205+ if err != nil {
206+ t .Fatalf ("read body: %v" , err )
207+ }
202208
203209 if resp .StatusCode != http .StatusOK {
204210 t .Errorf ("expected 200, got %d" , resp .StatusCode )
@@ -231,7 +237,9 @@ func TestWithProxyTransport_ProxyAuth(t *testing.T) {
231237 t .Fatalf ("GET through authenticated http proxy: %v" , err )
232238 }
233239 defer resp .Body .Close ()
234- io .ReadAll (resp .Body )
240+ if _ , err := io .ReadAll (resp .Body ); err != nil {
241+ t .Fatalf ("read body: %v" , err )
242+ }
235243
236244 if resp .StatusCode != http .StatusOK {
237245 t .Errorf ("expected 200, got %d" , resp .StatusCode )
@@ -249,7 +257,9 @@ func TestWithProxyTransport_ProxyAuth(t *testing.T) {
249257 t .Fatalf ("GET through authenticated https proxy: %v" , err )
250258 }
251259 defer resp .Body .Close ()
252- io .ReadAll (resp .Body )
260+ if _ , err := io .ReadAll (resp .Body ); err != nil {
261+ t .Fatalf ("read body: %v" , err )
262+ }
253263
254264 if resp .StatusCode != http .StatusOK {
255265 t .Errorf ("expected 200, got %d" , resp .StatusCode )
@@ -272,10 +282,12 @@ func TestWithProxyTransport_HTTPSProxy_HTTP2ToOrigin(t *testing.T) {
272282 t .Fatalf ("GET through https proxy: %v" , err )
273283 }
274284 defer resp .Body .Close ()
275- io .ReadAll (resp .Body )
285+ if _ , err := io .ReadAll (resp .Body ); err != nil {
286+ t .Fatalf ("read body: %v" , err )
287+ }
276288
277- if resp .Proto != "HTTP/2.0" {
278- t .Errorf ("expected HTTP/2.0 to origin, got %s" , resp .Proto )
289+ if resp .ProtoMajor != 2 {
290+ t .Errorf ("expected HTTP/2 to origin, got %s" , resp .Proto )
279291 }
280292}
281293
0 commit comments