[#577] Remove usages of deprecated io/ioutil

Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
This commit is contained in:
Angira Kekteeva 2022-08-09 16:37:08 +04:00 committed by Kira
parent e285ed313b
commit 1987f271f9
2 changed files with 3 additions and 4 deletions

View file

@ -60,7 +60,6 @@ import (
"encoding/hex" "encoding/hex"
"fmt" "fmt"
"io" "io"
"io/ioutil"
"net/http" "net/http"
"net/url" "net/url"
"sort" "sort"
@ -367,7 +366,7 @@ func (v4 Signer) signWithBody(r *http.Request, body io.ReadSeeker, service, regi
if body != nil { if body != nil {
var ok bool var ok bool
if reader, ok = body.(io.ReadCloser); !ok { if reader, ok = body.(io.ReadCloser); !ok {
reader = ioutil.NopCloser(body) reader = io.NopCloser(body)
} }
} }
r.Body = reader r.Body = reader

View file

@ -4,7 +4,7 @@ import (
"bytes" "bytes"
"crypto/rand" "crypto/rand"
"crypto/sha256" "crypto/sha256"
"io/ioutil" "io"
"testing" "testing"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -22,7 +22,7 @@ func TestWrapReader(t *testing.T) {
streamHash.Write(buf) streamHash.Write(buf)
}) })
dst, err := ioutil.ReadAll(wrappedReader) dst, err := io.ReadAll(wrappedReader)
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, src, dst) require.Equal(t, src, dst)
require.Equal(t, h[:], streamHash.Sum(nil)) require.Equal(t, h[:], streamHash.Sum(nil))