check retry for authorization error
This commit is contained in:
parent
1657c6abc7
commit
02524a56ff
1 changed files with 8 additions and 1 deletions
|
@ -1131,6 +1131,7 @@ func makeRequestWithRetry(ctx context.Context, method string, requestURL *url.UR
|
||||||
if !errors.Is(err, context.Canceled) {
|
if !errors.Is(err, context.Canceled) {
|
||||||
log.Printf("request failed: %v", err)
|
log.Printf("request failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1150,7 +1151,13 @@ func makeRequestWithRetry(ctx context.Context, method string, requestURL *url.UR
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return makeRequest(ctx, method, requestURL, headers, body, regOpts)
|
|
||||||
|
resp, err := makeRequest(ctx, method, requestURL, headers, body, regOpts)
|
||||||
|
if resp.StatusCode == http.StatusUnauthorized {
|
||||||
|
return nil, errUnauthorized
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, err
|
||||||
case resp.StatusCode == http.StatusNotFound:
|
case resp.StatusCode == http.StatusNotFound:
|
||||||
return nil, os.ErrNotExist
|
return nil, os.ErrNotExist
|
||||||
case resp.StatusCode >= http.StatusBadRequest:
|
case resp.StatusCode >= http.StatusBadRequest:
|
||||||
|
|
Loading…
Reference in a new issue