Skip to content

Commit

Permalink
Merge pull request #1116 from marcozac/master
Browse files Browse the repository at this point in the history
chore: replace the deprecated ioutil package
  • Loading branch information
jacobbednarz authored Oct 23, 2022
2 parents 43425bf + 26b4447 commit 5933e31
Show file tree
Hide file tree
Showing 22 changed files with 66 additions and 67 deletions.
3 changes: 3 additions & 0 deletions .changelog/1116.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:dependency
deps: `ioutil` package is being deprecated in favor of `io`
```
4 changes: 2 additions & 2 deletions accounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cloudflare
import (
"context"
"fmt"
"io/ioutil"
"io"
"net/http"
"testing"
"time"
Expand Down Expand Up @@ -109,7 +109,7 @@ func TestUpdateAccount(t *testing.T) {

mux.HandleFunc("/accounts/01a7362d577a6c3019a474fd6f485823", func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodPut, r.Method, "Expected method 'PUT', got %s", r.Method)
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
defer r.Body.Close()

if assert.NoError(t, err) {
Expand Down
11 changes: 5 additions & 6 deletions cloudflare.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"math"
"net/http"
Expand Down Expand Up @@ -57,7 +56,7 @@ type API struct {

// newClient provides shared logic for New and NewWithUserServiceKey.
func newClient(opts ...Option) (*API, error) {
silentLogger := log.New(ioutil.Discard, "", log.LstdFlags)
silentLogger := log.New(io.Discard, "", log.LstdFlags)

api := &API{
BaseURL: fmt.Sprintf("%s://%s%s", defaultScheme, defaultHostname, defaultBasePath),
Expand Down Expand Up @@ -255,8 +254,8 @@ func (api *API) makeRequestWithAuthTypeAndHeadersComplete(ctx context.Context, m
if method == http.MethodPost || method == http.MethodPut || method == http.MethodPatch {
buf := &bytes.Buffer{}
tee := io.TeeReader(reqBody, buf)
debugBody, _ := ioutil.ReadAll(tee)
payloadBody, _ := ioutil.ReadAll(buf)
debugBody, _ := io.ReadAll(tee)
payloadBody, _ := io.ReadAll(buf)
fmt.Printf("cloudflare-go [DEBUG] REQUEST Method:%v URI:%s Headers:%#v Body:%v\n", method, api.BaseURL+uri, headers, string(debugBody))
// ensure we recreate the io.Reader for use
reqBody = bytes.NewReader(payloadBody)
Expand All @@ -282,7 +281,7 @@ func (api *API) makeRequestWithAuthTypeAndHeadersComplete(ctx context.Context, m
// if we got a valid http response, try to read body so we can reuse the connection
// see https://golang.org/pkg/net/http/#Client.Do
if respErr == nil {
respBody, err = ioutil.ReadAll(resp.Body)
respBody, err = io.ReadAll(resp.Body)
resp.Body.Close()

respErr = fmt.Errorf("could not read response body: %w", err)
Expand All @@ -294,7 +293,7 @@ func (api *API) makeRequestWithAuthTypeAndHeadersComplete(ctx context.Context, m
}
continue
} else {
respBody, err = ioutil.ReadAll(resp.Body)
respBody, err = io.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
return nil, fmt.Errorf("could not read response body: %w", err)
Expand Down
7 changes: 3 additions & 4 deletions cloudflare_experimental.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"strings"
Expand Down Expand Up @@ -228,8 +227,8 @@ func (c *Client) makeRequest(ctx context.Context, method, uri string, params int
if method == http.MethodPost || method == http.MethodPut || method == http.MethodPatch {
buf := &bytes.Buffer{}
tee := io.TeeReader(reqBody, buf)
debugBody, _ := ioutil.ReadAll(tee)
payloadBody, _ := ioutil.ReadAll(buf)
debugBody, _ := io.ReadAll(tee)
payloadBody, _ := io.ReadAll(buf)
c.Logger.Debugf("REQUEST Method:%v URI:%s Headers:%#v Body:%v\n", method, c.BaseURL.String()+uri, headers, string(debugBody))
// ensure we recreate the io.Reader for use
reqBody = bytes.NewReader(payloadBody)
Expand All @@ -244,7 +243,7 @@ func (c *Client) makeRequest(ctx context.Context, method, uri string, params int

c.Logger.Debugf("RESPONSE URI:%s StatusCode:%d Body:%#v RayID:%s\n", c.BaseURL.String()+uri, resp.StatusCode, string(respBody), resp.Header.Get("cf-ray"))

respBody, err = ioutil.ReadAll(resp.Body)
respBody, err = io.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
return nil, fmt.Errorf("could not read response body: %w", err)
Expand Down
8 changes: 4 additions & 4 deletions custom_hostname_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cloudflare
import (
"context"
"fmt"
"io/ioutil"
"io"
"net/http"
"testing"
"time"
Expand Down Expand Up @@ -706,7 +706,7 @@ func TestCustomHostname_UpdateCustomHostname(t *testing.T) {
assert.Equal(t, http.MethodPatch, r.Method, "Expected method 'PATCH', got %s", r.Method)

defer r.Body.Close()
reqBody, err := ioutil.ReadAll(r.Body)
reqBody, err := io.ReadAll(r.Body)
assert.NoError(t, err, "Reading request body")
assert.JSONEq(t, `
{
Expand Down Expand Up @@ -786,7 +786,7 @@ func TestCustomHostname_UpdateCustomHostnameWithCustomMetadata(t *testing.T) {
assert.Equal(t, http.MethodPatch, r.Method, "Expected method 'PATCH', got %s", r.Method)

defer r.Body.Close()
reqBody, err := ioutil.ReadAll(r.Body)
reqBody, err := io.ReadAll(r.Body)
assert.NoError(t, err, "Reading request body")
assert.JSONEq(t, `
{
Expand Down Expand Up @@ -875,7 +875,7 @@ func TestCustomHostname_UpdateCustomHostnameWithEmptyCustomMetadata(t *testing.T
assert.Equal(t, http.MethodPatch, r.Method, "Expected method 'PATCH', got %s", r.Method)

defer r.Body.Close()
reqBody, err := ioutil.ReadAll(r.Body)
reqBody, err := io.ReadAll(r.Body)
assert.NoError(t, err, "Reading request body")
assert.JSONEq(t, `
{
Expand Down
6 changes: 3 additions & 3 deletions images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"strings"
"testing"
Expand Down Expand Up @@ -363,7 +363,7 @@ func parseImageMultipartUpload(r *http.Request) (imageMultipartUpload, error) {
}
defer f.Close()

u.File, err = ioutil.ReadAll(f)
u.File, err = io.ReadAll(f)
if err != nil {
return u, err
}
Expand All @@ -388,7 +388,7 @@ func getImageFormValue(r *http.Request, key string) ([]byte, error) {
if err != nil {
return nil, err
}
return ioutil.ReadAll(file)
return io.ReadAll(file)
}

return nil, fmt.Errorf("no value found for key %v", key)
Expand Down
4 changes: 2 additions & 2 deletions ips.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cloudflare
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"strings"
)
Expand Down Expand Up @@ -41,7 +41,7 @@ func IPs() (IPRanges, error) {
return IPRanges{}, fmt.Errorf("HTTP request failed: %w", err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return IPRanges{}, fmt.Errorf("Response body could not be read: %w", err)
}
Expand Down
14 changes: 7 additions & 7 deletions load_balancing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cloudflare
import (
"context"
"fmt"
"io/ioutil"
"io"
"net/http"
"testing"
"time"
Expand All @@ -18,7 +18,7 @@ func TestCreateLoadBalancerPool(t *testing.T) {
handler := func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodPost, r.Method, "Expected method 'POST', got %s", r.Method)
w.Header().Set("content-type", "application/json")
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
defer r.Body.Close()
if assert.NoError(t, err) {
assert.JSONEq(t, `{
Expand Down Expand Up @@ -397,7 +397,7 @@ func TestUpdateLoadBalancerPool(t *testing.T) {
handler := func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodPut, r.Method, "Expected method 'PUT', got %s", r.Method)
w.Header().Set("content-type", "application/json")
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
defer r.Body.Close()
if assert.NoError(t, err) {
assert.JSONEq(t, `{
Expand Down Expand Up @@ -539,7 +539,7 @@ func TestCreateLoadBalancerMonitor(t *testing.T) {
handler := func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodPost, r.Method, "Expected method 'POST', got %s", r.Method)
w.Header().Set("content-type", "application/json")
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
defer r.Body.Close()
if assert.NoError(t, err) {
assert.JSONEq(t, `{
Expand Down Expand Up @@ -862,7 +862,7 @@ func TestUpdateLoadBalancerMonitor(t *testing.T) {
handler := func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodPut, r.Method, "Expected method 'PUT', got %s", r.Method)
w.Header().Set("content-type", "application/json")
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
defer r.Body.Close()
if assert.NoError(t, err) {
assert.JSONEq(t, `{
Expand Down Expand Up @@ -988,7 +988,7 @@ func TestCreateLoadBalancer(t *testing.T) {
handler := func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodPost, r.Method, "Expected method 'POST', got %s", r.Method)
w.Header().Set("content-type", "application/json")
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
defer r.Body.Close()
if assert.NoError(t, err) {
assert.JSONEq(t, `{
Expand Down Expand Up @@ -1712,7 +1712,7 @@ func TestUpdateLoadBalancer(t *testing.T) {
handler := func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodPut, r.Method, "Expected method 'PUT', got %s", r.Method)
w.Header().Set("content-type", "application/json")
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
defer r.Body.Close()
if assert.NoError(t, err) {
assert.JSONEq(t, `{
Expand Down
4 changes: 2 additions & 2 deletions logpush_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"strconv"
Expand Down Expand Up @@ -246,7 +246,7 @@ func TestCreateLogpushJob(t *testing.T) {

handler := func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodPost, r.Method, "Expected method 'POST', got %s", r.Method)
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
defer r.Body.Close()

if assert.NoError(t, err) {
Expand Down
4 changes: 2 additions & 2 deletions origin_ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"time"
Expand Down Expand Up @@ -226,7 +226,7 @@ func OriginCARootCertificate(algorithm string) ([]byte, error) {
return nil, errors.New(errRequestNotSuccessful)
}

body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("Response body could not be read: %w", err)
}
Expand Down
12 changes: 6 additions & 6 deletions railgun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cloudflare
import (
"context"
"fmt"
"io/ioutil"
"io"
"net/http"
"testing"
"time"
Expand All @@ -18,7 +18,7 @@ func TestCreateRailgun(t *testing.T) {
handler := func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodPost, r.Method, "Expected method 'POST', got %s", r.Method)
w.Header().Set("content-type", "application/json")
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
defer r.Body.Close()
if assert.NoError(t, err) {
assert.JSONEq(t, `{"name":"My Railgun"}`, string(b))
Expand Down Expand Up @@ -254,7 +254,7 @@ func TestEnableRailgun(t *testing.T) {

handler := func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodPatch, r.Method, "Expected method 'PATCH', got %s", r.Method)
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
defer r.Body.Close()
if assert.NoError(t, err) {
assert.JSONEq(t, `{"enabled":true}`, string(b))
Expand Down Expand Up @@ -315,7 +315,7 @@ func TestDisableRailgun(t *testing.T) {

handler := func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodPatch, r.Method, "Expected method 'PATCH', got %s", r.Method)
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
defer r.Body.Close()
if assert.NoError(t, err) {
assert.JSONEq(t, `{"enabled":false}`, string(b))
Expand Down Expand Up @@ -543,7 +543,7 @@ func TestConnectRailgun(t *testing.T) {

handler := func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodPatch, r.Method, "Expected method 'PATCH', got %s", r.Method)
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
defer r.Body.Close()
if assert.NoError(t, err) {
assert.JSONEq(t, `{"connected":true}`, string(b))
Expand Down Expand Up @@ -585,7 +585,7 @@ func TestDisconnectRailgun(t *testing.T) {

handler := func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodPatch, r.Method, "Expected method 'PATCH', got %s", r.Method)
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
defer r.Body.Close()
if assert.NoError(t, err) {
assert.JSONEq(t, `{"connected":false}`, string(b))
Expand Down
8 changes: 4 additions & 4 deletions ssl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cloudflare
import (
"context"
"fmt"
"io/ioutil"
"io"
"net/http"
"testing"
"time"
Expand All @@ -17,7 +17,7 @@ func TestCreateSSL(t *testing.T) {

handler := func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodPost, r.Method, "Expected method 'POST', got %s", r.Method)
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
defer r.Body.Close()

if assert.NoError(t, err) {
Expand Down Expand Up @@ -220,7 +220,7 @@ func TestUpdateSSL(t *testing.T) {

handler := func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodPatch, r.Method, "Expected method 'PATCH', got %s", r.Method)
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
defer r.Body.Close()
if assert.NoError(t, err) {
assert.JSONEq(t, `{"certificate":"-----BEGIN CERTIFICATE----- MIIDtTCCAp2gAwIBAgIJAM15n7fdxhRtMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV BAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX aWRnaXRzIFB0eSBMdGQwHhcNMTQwMzExMTkyMTU5WhcNMTQwNDEwMTkyMTU5WjBF MQswCQYDVQQGEwJVUzETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50 ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB CgKCAQEAvq3sKsHpeduJHimOK+fvQdKsI8z8A05MZyyLp2/R/GE8FjNv+hkVY1WQ LIyTNNQH7CJecE1nbTfo8Y56S7x/rhxC6/DJ8MIulapFPnorq46KU6yRxiM0MQ3N nTJHlHA2ozZta6YBBfVfhHWl1F0IfNbXCLKvGwWWMbCx43OfW6KTkbRnE6gFWKuO fSO5h2u5TaWVuSIzBvYs7Vza6m+gtYAvKAJV2nSZ+eSEFPDo29corOy8+huEOUL8 5FAw4BFPsr1TlrlGPFitduQUHGrSL7skk1ESGza0to3bOtrodKei2s9bk5MXm7lZ qI+WZJX4Zu9+mzZhc9pCVi8r/qlXuQIDAQABo4GnMIGkMB0GA1UdDgQWBBRvavf+ sWM4IwKiH9X9w1vl6nUVRDB1BgNVHSMEbjBsgBRvavf+sWM4IwKiH9X9w1vl6nUV RKFJpEcwRTELMAkGA1UEBhMCVVMxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV BAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAM15n7fdxhRtMAwGA1UdEwQF MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBABY2ZzBaW0dMsAAT7tPJzrVWVzQx6KU4 UEBLudIlWPlkAwTnINCWR/8eNjCCmGA4heUdHmazdpPa8RzwOmc0NT1NQqzSyktt vTqb4iHD7+8f9MqJ9/FssCfTtqr/Qst/hGH4Wmdf1EJ/6FqYAAb5iRlPgshFZxU8 uXtA8hWn6fK6eISD9HBdcAFToUvKNZ1BIDPvh9f95Ine8ar6yGd56TUNrHR8eHBs ESxz5ddVR/oWRysNJ+aGAyYqHS8S/ttmC7r4XCAHqXptkHPCGRqkAhsterYhd4I8 /cBzejUobNCjjHFbtkAL/SjxZOLW+pNkZwfeYdM8iPkD54Uua1v2tdw= -----END CERTIFICATE-----","geo_restrictions":{"label":"us"},"private_key":"-----BEGIN RSA PRIVATE KEY-----MIIEowIBAAKCAQEAl 1cSc0vfcJLI4ZdWjiZZqy86Eof4czCwilyjXdvHqbdgDjz9H6K/0FX78EzVdfyExESptPCDl5YYjvcZyAWlgNfYEpFpGeoh/pTFW3hlyKImh4EgBXbDrR251J Ew2Nf56X3duibI6X20gKZA6cvdmWeKh MOOXuh1bSPU3dkb4YOF/fng5iGrx0q3txdMQXTPMZ1uXHFcBH7idgViYesXUBhdll3GP1N Y8laq0yrqh 8HMsZK m27MebqonbNmjOqE218lVEvjCdRO6xvNXrO6vNJBoGn2eGwZ8BVd0mTA3Tj43/2cmxQFY9FLq56cCXqYI1fbRRib ZLrjSNkwIDAQABAoIBABfAjjsjjxc0NxcYvKOMUb9Rpj8Sx6U/o/tDC5u XmsGX37aaJmC5yw9BQiAxgvXtQryEl5uoNoqOdsxzKV6yM0vPcwKEJVBd4G6yx6AjVJZnc2qf72erR7BbA2CQh scMDRBKE041HhgTBRNP6roim0SOgYP5JZIrGAQXNIkyE0fZc5gZNUt388ne/mjWM6Xi08BDGurLC68nsdt7Nd UYqeBVxo2EqChp5vKYZYEcG8h9XBj4u4NIwg1Mty2JqX30uBjoHvF5w/pMs8lG uvj6JR9I 19wtCuccbAJl 4cUq03UQoIDmwejea oC8A8WJr3vVpODDWrvAsjllGPBECgYEAyQRa6edYO6bsSvgbM13qXW9OQTn9YmgzfN24Ux1D66TQU6sBSLdfSHshDhTCi Ax 698aJNRWujAakA2DDgspSx98aRnHbF zvY7i7iWGesN6uN0zL 6/MK5uWoieGZRjgk230fLk00l4/FK1mJIp0apr0Lis9xmDjP5AaUPTUUCgYEAwXuhTHZWPT6v8YwOksjbuK UDkIIvyMux53kb73vrkgMboS4DB1zMLNyG 9EghS414CFROUwGl4ZUKboH1Jo5G34y8VgDuHjirTqL2H6 zNpML iMrWCXjpFKkxwPbeQnEAZ 5Rud4d PTyXAt71blZHE9tZ4KHy8cU1iKc9APcCgYAIqKZd4vg7AZK2G//X85iv06aUSrIudfyZyVcyRVVyphPPNtOEVVnGXn9rAtvqeIrOo52BR68 cj4vlXp hkDuEH QVBuY/NdQhOzFtPrKPQTJdGjIlQ2x65Vidj7r3sRukNkLPyV2v D885zcpTkp83JFuWTYiIrg275DIuAI3QKBgAglM0IrzS g3vlVQxvM1ussgRgkkYeybHq82 wUW 3DXLqeXb0s1DedplUkuoabZriz0Wh4GZFSmtA5ZpZC uV697lkYsndmp2xRhaekllW7bu pY5q88URwO2p8CO5AZ6CWFWuBwSDML5VOapGRqDRgwaD oGpb7fb7IgHOls7AoGBAJnL6Q8t35uYJ8J8hY7wso88IE04z6VaT8WganxcndesWER9eFQDHDDy//ZYeyt6M41uIY CL Vkm9Kwl/bHLJKdnOE1a9NdE6mtfah0Bk2u/YOuzyu5mmcgZiX X/OZuEbGmmbZOR1FCuIyrNYfwYohhcZP7/r0Ia/1GpkHc3Bi-----END RSA PRIVATE KEY-----","bundle_method":"ubiquitous"}`, string(b))
Expand Down Expand Up @@ -294,7 +294,7 @@ func TestReprioritizeSSL(t *testing.T) {

handler := func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodPut, r.Method, "Expected method 'PUT', got %s", r.Method)
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
defer r.Body.Close()
if assert.NoError(t, err) {
assert.JSONEq(t, `{"certificates":[{"ID":"5a7805061c76ada191ed06f989cc3dac","priority":2},{"ID":"9a7806061c88ada191ed06f989cc3dac","priority":1}]}`, string(b))
Expand Down
4 changes: 2 additions & 2 deletions sts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"io"
"net/http"

"github.com/hashicorp/go-retryablehttp"
Expand Down Expand Up @@ -80,7 +80,7 @@ func fetchSTSCredentials(stsConfig *SecurityTokenConfiguration) (string, error)
}

var respBody []byte
respBody, err = ioutil.ReadAll(resp.Body)
respBody, err = io.ReadAll(resp.Body)
if err != nil {
return "", fmt.Errorf("failed to read response body: %w", err)
}
Expand Down
Loading

0 comments on commit 5933e31

Please sign in to comment.