mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Handle ioutil deprecations (#53526)
* replace ioutil.ReadFile -> os.ReadFile * replace ioutil.ReadAll -> io.ReadAll * replace ioutil.TempFile -> os.CreateTemp * replace ioutil.NopCloser -> io.NopCloser * replace ioutil.WriteFile -> os.WriteFile * replace ioutil.TempDir -> os.MkdirTemp * replace ioutil.Discard -> io.Discard
This commit is contained in:
@@ -3,7 +3,7 @@ package httpclient
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -23,10 +23,10 @@ func TestMaxBytesReader(t *testing.T) {
|
||||
}
|
||||
for _, tc := range tcs {
|
||||
t.Run(fmt.Sprintf("Test MaxBytesReader with limit: %d", tc.limit), func(t *testing.T) {
|
||||
body := ioutil.NopCloser(strings.NewReader("dummy"))
|
||||
body := io.NopCloser(strings.NewReader("dummy"))
|
||||
readCloser := MaxBytesReader(body, tc.limit)
|
||||
|
||||
bodyBytes, err := ioutil.ReadAll(readCloser)
|
||||
bodyBytes, err := io.ReadAll(readCloser)
|
||||
if err != nil {
|
||||
require.EqualError(t, tc.err, err.Error())
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user