chore: remove usage of ioutil (#642)

It was deprecated as of 1.17.
This commit is contained in:
Colin Adler
2022-03-29 14:59:32 -05:00
committed by GitHub
parent 8c0f109240
commit 3abb87ddb6
9 changed files with 28 additions and 27 deletions

View File

@ -13,7 +13,6 @@ import (
"encoding/json"
"encoding/pem"
"io"
"io/ioutil"
"math/big"
"net"
"net/http"
@ -323,7 +322,7 @@ func NewGoogleInstanceIdentity(t *testing.T, instanceID string, expired bool) (*
require.NoError(t, err)
return &http.Response{
StatusCode: http.StatusOK,
Body: ioutil.NopCloser(bytes.NewReader(data)),
Body: io.NopCloser(bytes.NewReader(data)),
Header: make(http.Header),
}, nil
}),
@ -334,7 +333,7 @@ func NewGoogleInstanceIdentity(t *testing.T, instanceID string, expired bool) (*
Transport: roundTripper(func(r *http.Request) (*http.Response, error) {
return &http.Response{
StatusCode: http.StatusOK,
Body: ioutil.NopCloser(bytes.NewReader([]byte(signedKey))),
Body: io.NopCloser(bytes.NewReader([]byte(signedKey))),
Header: make(http.Header),
}, nil
}),
@ -379,19 +378,19 @@ func NewAWSInstanceIdentity(t *testing.T, instanceID string) (awsidentity.Certif
case "/latest/api/token":
return &http.Response{
StatusCode: http.StatusOK,
Body: ioutil.NopCloser(bytes.NewReader([]byte("faketoken"))),
Body: io.NopCloser(bytes.NewReader([]byte("faketoken"))),
Header: make(http.Header),
}, nil
case "/latest/dynamic/instance-identity/signature":
return &http.Response{
StatusCode: http.StatusOK,
Body: ioutil.NopCloser(bytes.NewReader(signature)),
Body: io.NopCloser(bytes.NewReader(signature)),
Header: make(http.Header),
}, nil
case "/latest/dynamic/instance-identity/document":
return &http.Response{
StatusCode: http.StatusOK,
Body: ioutil.NopCloser(bytes.NewReader(document)),
Body: io.NopCloser(bytes.NewReader(document)),
Header: make(http.Header),
}, nil
default: