From b2ebe857da3a04e2a60c85c5566e5ea828009a7f Mon Sep 17 00:00:00 2001 From: Andriy Borodiychuk Date: Tue, 26 Mar 2024 18:08:00 +0100 Subject: [PATCH] Replace deprecated ioutil --- backend.go | 4 ++-- backend_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend.go b/backend.go index 1550ddb..67d7c27 100644 --- a/backend.go +++ b/backend.go @@ -5,7 +5,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" ) @@ -56,7 +56,7 @@ func (b *APIKeyBackend) Request(ctx context.Context, method, path string, payloa return fmt.Errorf("unable to perform HTTP request: %w", err) } defer resp.Body.Close() - body, err = ioutil.ReadAll(resp.Body) + body, err = io.ReadAll(resp.Body) if err != nil { return fmt.Errorf("unable to read from HTTP response body: %w", err) } diff --git a/backend_test.go b/backend_test.go index 411ccd9..d29c587 100644 --- a/backend_test.go +++ b/backend_test.go @@ -3,7 +3,7 @@ package hasty import ( "context" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "strings" @@ -24,7 +24,7 @@ type testReq struct { func TestAPIKeyBackend(t *testing.T) { reqs := make(chan testReq, 1) ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - body, _ := ioutil.ReadAll(r.Body) + body, _ := io.ReadAll(r.Body) reqs <- testReq{ method: r.Method, path: r.URL.Path,