Dedup code and migrate away from deprecated funcs (#1141)

Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
6543
2022-08-30 01:14:07 +02:00
committed by GitHub
parent ca84f703e3
commit 08a99152d6
25 changed files with 86 additions and 113 deletions

View File

@@ -18,7 +18,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"strings"
@@ -84,7 +84,7 @@ func (c *Client) Do(method, u string, params url.Values) ([]byte, error) {
return nil, fmt.Errorf("%s %s respond %d", req.Method, req.URL, resp.StatusCode)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("fail to read response from %s %s: %v", req.Method, req.URL.String(), err)
}