Skip to content

Commit

Permalink
Replace deprecated ioutil
Browse files Browse the repository at this point in the history
  • Loading branch information
borodiychuk committed Mar 26, 2024
1 parent d8d1a43 commit b2ebe85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions backend.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"
)

Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package hasty
import (
"context"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"strings"
Expand All @@ -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,
Expand Down

0 comments on commit b2ebe85

Please sign in to comment.