@@ -24,7 +24,6 @@ import (
24
24
"errors"
25
25
"fmt"
26
26
"io"
27
- "io/ioutil"
28
27
"math/rand"
29
28
"net/http"
30
29
"net/http/httptest"
@@ -698,7 +697,7 @@ func extractBody(response *http.Response, object runtime.Object) (string, error)
698
697
699
698
func extractBodyDecoder (response * http.Response , object runtime.Object , decoder runtime.Decoder ) (string , error ) {
700
699
defer response .Body .Close ()
701
- body , err := ioutil .ReadAll (response .Body )
700
+ body , err := io .ReadAll (response .Body )
702
701
if err != nil {
703
702
return string (body ), err
704
703
}
@@ -707,7 +706,7 @@ func extractBodyDecoder(response *http.Response, object runtime.Object, decoder
707
706
708
707
func extractBodyObject (response * http.Response , decoder runtime.Decoder ) (runtime.Object , string , error ) {
709
708
defer response .Body .Close ()
710
- body , err := ioutil .ReadAll (response .Body )
709
+ body , err := io .ReadAll (response .Body )
711
710
if err != nil {
712
711
return nil , string (body ), err
713
712
}
@@ -865,7 +864,7 @@ func TestUnimplementedRESTStorage(t *testing.T) {
865
864
response , err := client .Do (request )
866
865
require .NoError (t , err )
867
866
defer apitesting .Close (t , response .Body )
868
- data , err := ioutil .ReadAll (response .Body )
867
+ data , err := io .ReadAll (response .Body )
869
868
require .NoError (t , err )
870
869
require .Equal (t , v .ErrCode , response .StatusCode , string (data ))
871
870
})
@@ -928,7 +927,7 @@ func TestSomeUnimplementedRESTStorage(t *testing.T) {
928
927
response , err := client .Do (request )
929
928
require .NoError (t , err )
930
929
defer apitesting .Close (t , response .Body )
931
- data , err := ioutil .ReadAll (response .Body )
930
+ data , err := io .ReadAll (response .Body )
932
931
require .NoError (t , err )
933
932
require .Equal (t , v .ErrCode , response .StatusCode , string (data ))
934
933
})
@@ -1091,7 +1090,7 @@ func TestList(t *testing.T) {
1091
1090
defer apitesting .Close (t , resp .Body )
1092
1091
if resp .StatusCode != http .StatusOK {
1093
1092
t .Errorf ("unexpected status: %d from url %s, Expected: %d, %#v" , resp .StatusCode , testCase .url , http .StatusOK , resp )
1094
- body , err := ioutil .ReadAll (resp .Body )
1093
+ body , err := io .ReadAll (resp .Body )
1095
1094
require .NoError (t , err )
1096
1095
t .Logf ("body: %s" , string (body ))
1097
1096
return
@@ -1143,7 +1142,7 @@ func TestRequestsWithInvalidQuery(t *testing.T) {
1143
1142
defer apitesting .Close (t , resp .Body )
1144
1143
if resp .StatusCode != http .StatusBadRequest {
1145
1144
t .Errorf ("unexpected status: %d from url %s, Expected: %d, %#v" , resp .StatusCode , url , http .StatusBadRequest , resp )
1146
- body , err := ioutil .ReadAll (resp .Body )
1145
+ body , err := io .ReadAll (resp .Body )
1147
1146
require .NoError (t , err )
1148
1147
t .Logf ("body: %s" , string (body ))
1149
1148
}
@@ -1202,7 +1201,7 @@ func TestListCompression(t *testing.T) {
1202
1201
defer apitesting .Close (t , resp .Body )
1203
1202
if resp .StatusCode != http .StatusOK {
1204
1203
t .Errorf ("unexpected status: %d from url %s, Expected: %d, %#v" , resp .StatusCode , testCase .url , http .StatusOK , resp )
1205
- body , err := ioutil .ReadAll (resp .Body )
1204
+ body , err := io .ReadAll (resp .Body )
1206
1205
require .NoError (t , err )
1207
1206
t .Logf ("body: %s" , string (body ))
1208
1207
return
@@ -1403,7 +1402,7 @@ func BenchmarkGet(b *testing.B) {
1403
1402
require .NoError (b , err )
1404
1403
defer apitesting .Close (b , resp .Body )
1405
1404
require .Equal (b , http .StatusOK , resp .StatusCode )
1406
- _ , err = io .Copy (ioutil .Discard , resp .Body )
1405
+ _ , err = io .Copy (io .Discard , resp .Body )
1407
1406
require .NoError (b , err )
1408
1407
}()
1409
1408
}
@@ -1442,7 +1441,7 @@ func BenchmarkGetNoCompression(b *testing.B) {
1442
1441
require .NoError (b , err )
1443
1442
defer apitesting .Close (b , resp .Body )
1444
1443
require .Equal (b , http .StatusOK , resp .StatusCode )
1445
- _ , err = io .Copy (ioutil .Discard , resp .Body )
1444
+ _ , err = io .Copy (io .Discard , resp .Body )
1446
1445
require .NoError (b , err )
1447
1446
}()
1448
1447
}
@@ -1946,10 +1945,10 @@ func TestWatchTable(t *testing.T) {
1946
1945
test .send (watcher )
1947
1946
}()
1948
1947
1949
- body , err := ioutil .ReadAll (resp .Body )
1948
+ body , err := io .ReadAll (resp .Body )
1950
1949
require .NoError (t , err )
1951
1950
t .Logf ("Body:\n %s" , string (body ))
1952
- d := watchDecoder (resp .Header .Get ("Content-Type" ), ioutil .NopCloser (bytes .NewReader (body )))
1951
+ d := watchDecoder (resp .Header .Get ("Content-Type" ), io .NopCloser (bytes .NewReader (body )))
1953
1952
var actual []* metav1.WatchEvent
1954
1953
for {
1955
1954
var event metav1.WatchEvent
@@ -2157,7 +2156,7 @@ func TestGetBinary(t *testing.T) {
2157
2156
require .NoError (t , err )
2158
2157
defer apitesting .Close (t , resp .Body )
2159
2158
require .Equal (t , http .StatusOK , resp .StatusCode )
2160
- body , err := ioutil .ReadAll (resp .Body )
2159
+ body , err := io .ReadAll (resp .Body )
2161
2160
require .NoError (t , err )
2162
2161
if ! stream .closed || stream .version != testGroupVersion .String () || stream .accept != "text/other, */*" ||
2163
2162
resp .Header .Get ("Content-Type" ) != stream .contentType || string (body ) != "response data" {
@@ -2392,7 +2391,7 @@ func TestConnect(t *testing.T) {
2392
2391
require .NoError (t , err )
2393
2392
defer apitesting .Close (t , resp .Body )
2394
2393
require .Equal (t , http .StatusOK , resp .StatusCode )
2395
- body , err := ioutil .ReadAll (resp .Body )
2394
+ body , err := io .ReadAll (resp .Body )
2396
2395
require .NoError (t , err )
2397
2396
if connectStorage .receivedID != itemID {
2398
2397
t .Errorf ("Unexpected item id. Expected: %s. Actual: %s." , itemID , connectStorage .receivedID )
@@ -2427,7 +2426,7 @@ func TestConnectResponderObject(t *testing.T) {
2427
2426
require .NoError (t , err )
2428
2427
defer apitesting .Close (t , resp .Body )
2429
2428
require .Equal (t , http .StatusCreated , resp .StatusCode )
2430
- body , err := ioutil .ReadAll (resp .Body )
2429
+ body , err := io .ReadAll (resp .Body )
2431
2430
require .NoError (t , err )
2432
2431
if connectStorage .receivedID != itemID {
2433
2432
t .Errorf ("Unexpected item id. Expected: %s. Actual: %s." , itemID , connectStorage .receivedID )
@@ -2463,7 +2462,7 @@ func TestConnectResponderError(t *testing.T) {
2463
2462
require .NoError (t , err )
2464
2463
defer apitesting .Close (t , resp .Body )
2465
2464
require .Equal (t , http .StatusForbidden , resp .StatusCode )
2466
- body , err := ioutil .ReadAll (resp .Body )
2465
+ body , err := io .ReadAll (resp .Body )
2467
2466
require .NoError (t , err )
2468
2467
if connectStorage .receivedID != itemID {
2469
2468
t .Errorf ("Unexpected item id. Expected: %s. Actual: %s." , itemID , connectStorage .receivedID )
@@ -2524,7 +2523,7 @@ func TestConnectWithOptions(t *testing.T) {
2524
2523
require .NoError (t , err )
2525
2524
defer apitesting .Close (t , resp .Body )
2526
2525
require .Equal (t , http .StatusOK , resp .StatusCode )
2527
- body , err := ioutil .ReadAll (resp .Body )
2526
+ body , err := io .ReadAll (resp .Body )
2528
2527
require .NoError (t , err )
2529
2528
if connectStorage .receivedID != itemID {
2530
2529
t .Errorf ("Unexpected item id. Expected: %s. Actual: %s." , itemID , connectStorage .receivedID )
@@ -2568,7 +2567,7 @@ func TestConnectWithOptionsAndPath(t *testing.T) {
2568
2567
require .NoError (t , err )
2569
2568
defer apitesting .Close (t , resp .Body )
2570
2569
require .Equal (t , http .StatusOK , resp .StatusCode )
2571
- body , err := ioutil .ReadAll (resp .Body )
2570
+ body , err := io .ReadAll (resp .Body )
2572
2571
require .NoError (t , err )
2573
2572
assert .Equal (t , itemID , connectStorage .receivedID )
2574
2573
assert .Equal (t , responseText , string (body ))
@@ -4018,11 +4017,11 @@ func BenchmarkUpdateProtobuf(b *testing.B) {
4018
4017
require .NoError (b , err )
4019
4018
defer apitesting .Close (b , response .Body )
4020
4019
if response .StatusCode != http .StatusBadRequest {
4021
- body , err := ioutil .ReadAll (response .Body )
4020
+ body , err := io .ReadAll (response .Body )
4022
4021
require .NoError (b , err )
4023
4022
b .Fatalf ("Unexpected response %#v\n %s" , response , body )
4024
4023
}
4025
- _ , err = ioutil .ReadAll (response .Body )
4024
+ _ , err = io .ReadAll (response .Body )
4026
4025
require .NoError (b , err )
4027
4026
}()
4028
4027
}
0 commit comments