Add basic auth and fix repair issues
This commit is contained in:
@@ -153,12 +153,13 @@ func (r *HTTPClient) Do(req *http.Request) (*http.Response, error) {
|
||||
attempt := 0
|
||||
for {
|
||||
resp, err = r.client.Do(req)
|
||||
if resp != nil && resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusPartialContent {
|
||||
if resp != nil && (resp.StatusCode < http.StatusOK || resp.StatusCode > http.StatusPartialContent) {
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
if body != nil {
|
||||
var errResp ErrorResponse
|
||||
jsonErr := json.Unmarshal(body, &errResp)
|
||||
if jsonErr == nil {
|
||||
errResp.Message += fmt.Sprintf(" (status code: %d)", resp.StatusCode)
|
||||
err = &errResp
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user