mirror of https://github.com/ceph/go-ceph
rgw: remove refs to deprecated io/ioutil
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
This commit is contained in:
parent
8638693136
commit
ce4031e218
|
@ -3,7 +3,7 @@ package admin
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
|
@ -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 {
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
|
@ -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" {
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"testing"
|
||||
|
@ -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" {
|
||||
|
|
Loading…
Reference in New Issue