fix response on token error
This commit is contained in:
parent
b9229ffca5
commit
e805ac1d59
1 changed files with 8 additions and 2 deletions
|
@ -111,8 +111,14 @@ func getAuthToken(ctx context.Context, redirData AuthRedirect) (string, error) {
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
if resp.StatusCode >= http.StatusBadRequest {
|
if resp.StatusCode >= http.StatusBadRequest {
|
||||||
body, _ := io.ReadAll(resp.Body)
|
responseBody, err := io.ReadAll(resp.Body)
|
||||||
return "", fmt.Errorf("on pull registry responded with code %d: %s", resp.StatusCode, body)
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("%d: %v", resp.StatusCode, err)
|
||||||
|
} else if len(responseBody) > 0 {
|
||||||
|
return "", fmt.Errorf("%d: %s", resp.StatusCode, responseBody)
|
||||||
|
}
|
||||||
|
|
||||||
|
return "", fmt.Errorf("%s", resp.Status)
|
||||||
}
|
}
|
||||||
|
|
||||||
respBody, err := io.ReadAll(resp.Body)
|
respBody, err := io.ReadAll(resp.Body)
|
||||||
|
|
Loading…
Reference in a new issue