fix(lint): check Body.Close error return in http client
This commit is contained in:
@@ -61,7 +61,7 @@ func (c *Client) doOnce(ctx context.Context, method, path string, body []byte) (
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer func() { _ = resp.Body.Close() }()
|
||||||
b, err := io.ReadAll(resp.Body)
|
b, err := io.ReadAll(resp.Body)
|
||||||
return b, resp.StatusCode, err
|
return b, resp.StatusCode, err
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ func (c *Client) doRaw(ctx context.Context, method, path string, body []byte) (*
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer func() { _ = resp.Body.Close() }()
|
||||||
b, err := io.ReadAll(resp.Body)
|
b, err := io.ReadAll(resp.Body)
|
||||||
return &rawResponse{Body: b, Status: resp.StatusCode, Headers: resp.Header}, err
|
return &rawResponse{Body: b, Status: resp.StatusCode, Headers: resp.Header}, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user