Updated according to source

Updated according to https://github.com/rusenask/docker-registry-client/pull/2
pull/479/head
Dennis 2020-02-11 11:22:43 +01:00 committed by GitHub
parent 127a820268
commit 79f9b0dbf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -28,6 +28,7 @@ func (t *TokenTransport) RoundTrip(req *http.Request) (*http.Response, error) {
type authToken struct {
Token string `json:"token"`
AccessToken string `json:"access_token"`
}
func (t *TokenTransport) authAndRetry(authService *authService, req *http.Request) (*http.Response, error) {
@ -63,7 +64,11 @@ func (t *TokenTransport) auth(authService *authService) (string, *http.Response,
return "", nil, err
}
return authToken.Token, nil, nil
if authToken.Token == "" {
return authToken.AccessToken, nil, nil
} else {
return authToken.Token, nil, nil
}
}
func (t *TokenTransport) retry(req *http.Request, token string) (*http.Response, error) {