chore: remove refs to deprecated io/ioutil

Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
This commit is contained in:
guoguangwu committed 2023-10-19 11:05:38 +08:00
1 parent 958b0671bd
commit 115e48a202
12 files changed
+56 -59

No files matched your search

+2 -2
View File
@@ -18,7 +18,7 @@ package httperror_test
import (
"encoding/json"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"testing"
@@ -53,7 +53,7 @@ func TestErrorJSONSetsBodyCorrectly(t *testing.T) {
httperror.ErrorJSON(w, expectedReason, http.StatusNotFound)
errMsg := httperror.ServerErrMessage{}
if bodyBytes, err := ioutil.ReadAll(w.Result().Body); err != nil {
if bodyBytes, err := io.ReadAll(w.Result().Body); err != nil {
t.Errorf("Unexpected error reading response body: %v", err)
} else if err := json.Unmarshal(bodyBytes, &errMsg); err != nil {
t.Errorf("Response body contains invalid JSON entity: %v", err)