1
0
mirror of synced 2024-11-25 06:26:03 +03:00

fix undefined package error

This commit is contained in:
Ruslan Efanov 2022-10-28 10:05:11 +03:00
parent bb57d2c2e8
commit a321456c78
2 changed files with 5 additions and 4 deletions

View File

@ -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)

View File

@ -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