linter fixes
This commit is contained in:
parent
4bf887e75f
commit
df5babf6c8
15 changed files with 49 additions and 55 deletions
|
|
@ -7,19 +7,16 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
sync.Mutex
|
||||
endpoint string
|
||||
username string
|
||||
password string
|
||||
|
|
@ -193,13 +190,13 @@ func (c *Client) Do(r *http.Request, v interface{}) (resp *http.Response, err er
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
resp.Body.Close()
|
||||
return
|
||||
}
|
||||
resp.Body.Close()
|
||||
resp.Body = ioutil.NopCloser(bytes.NewReader(body))
|
||||
resp.Body = io.NopCloser(bytes.NewReader(body))
|
||||
|
||||
if c.debugWriter != nil {
|
||||
dumpResp, err := httputil.DumpResponse(resp, true)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@ func (e Error) Error() string {
|
|||
return e.Err
|
||||
}
|
||||
|
||||
func (e Error) Is(target error) bool {
|
||||
return e.Err == target.Error()
|
||||
}
|
||||
|
||||
func decodeResp(resp *http.Response, v interface{}) error {
|
||||
if resp.Body == nil {
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue