fix undefined package error
This commit is contained in:
parent
bb57d2c2e8
commit
a321456c78
@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"testing"
|
||||
@ -39,7 +39,7 @@ func TestNewApiClientError(t *testing.T) {
|
||||
func TestNewServerError(t *testing.T) {
|
||||
body := []byte(`{"errors" : ["Something went wrong"]}`)
|
||||
response := new(http.Response)
|
||||
response.Body = io.NopCloser(bytes.NewReader(body))
|
||||
response.Body = ioutil.NopCloser(bytes.NewReader(body))
|
||||
serverErr := NewServerError(response)
|
||||
|
||||
assert.IsType(t, new(HTTPClientError), serverErr)
|
||||
@ -54,7 +54,7 @@ func TestNewServerError(t *testing.T) {
|
||||
|
||||
body = []byte(`{"invalid_json"`)
|
||||
response = new(http.Response)
|
||||
response.Body = io.NopCloser(bytes.NewReader(body))
|
||||
response.Body = ioutil.NopCloser(bytes.NewReader(body))
|
||||
serverErr = NewServerError(response)
|
||||
|
||||
assert.IsType(t, new(HTTPClientError), serverErr)
|
||||
|
@ -2,6 +2,7 @@ package v1
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
@ -11,7 +12,7 @@ func buildLimitedRawResponse(resp *http.Response) ([]byte, error) {
|
||||
defer resp.Body.Close()
|
||||
|
||||
limitReader := io.LimitReader(resp.Body, MB)
|
||||
body, err := io.ReadAll(limitReader)
|
||||
body, err := ioutil.ReadAll(limitReader)
|
||||
|
||||
if err != nil {
|
||||
return body, err
|
||||
|
Loading…
Reference in New Issue
Block a user