Skip to content

Commit

Permalink
rgw: remove refs to deprecated io/ioutil
Browse files Browse the repository at this point in the history
Signed-off-by: guoguangwu <[email protected]>
  • Loading branch information
testwill authored and mergify[bot] committed Jul 8, 2023
1 parent 8638693 commit ce4031e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions rgw/admin/radosgw.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package admin
import (
"bytes"
"context"
"io/ioutil"
"io"
"net/http"
"net/url"
"time"
Expand Down Expand Up @@ -98,12 +98,12 @@ func (api *API) call(ctx context.Context, httpMethod, path string, args url.Valu
defer resp.Body.Close()

// Decode HTTP response
decodedResponse, err := ioutil.ReadAll(resp.Body)
decodedResponse, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}

resp.Body = ioutil.NopCloser(bytes.NewBuffer(decodedResponse))
resp.Body = io.NopCloser(bytes.NewBuffer(decodedResponse))

// Handle error in response
if resp.StatusCode >= 300 {
Expand Down
4 changes: 2 additions & 2 deletions rgw/admin/subuser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"context"
"fmt"
"io/ioutil"
"io"
"net/http"
"testing"

Expand Down Expand Up @@ -57,7 +57,7 @@ func TestCreateSubuserMockAPI(t *testing.T) {

// mockClient is defined in user_test.go
func returnMockClientCreateSubuser() *mockClient {
r := ioutil.NopCloser(bytes.NewReader([]byte("")))
r := io.NopCloser(bytes.NewReader([]byte("")))
return &mockClient{
mockDo: func(req *http.Request) (*http.Response, error) {
if req.Method == http.MethodPut && req.URL.Path == "127.0.0.1/admin/user" {
Expand Down
4 changes: 2 additions & 2 deletions rgw/admin/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"io"
"net/http"
"os"
"testing"
Expand Down Expand Up @@ -248,7 +248,7 @@ func TestGetUserMockAPI(t *testing.T) {
}

func returnMockClient() *mockClient {
r := ioutil.NopCloser(bytes.NewReader(fakeUserResponse))
r := io.NopCloser(bytes.NewReader(fakeUserResponse))
return &mockClient{
mockDo: func(req *http.Request) (*http.Response, error) {
if req.Method == http.MethodGet && req.URL.Path == "127.0.0.1/admin/user" {
Expand Down

0 comments on commit ce4031e

Please sign in to comment.