Add required changes after merge

Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>
pull/11129/head
Antonio Gamez Diaz 1 year ago
parent ad6f45819a
commit 197d1defbf
No known key found for this signature in database
GPG Key ID: 96108DED40068D35

@ -87,6 +87,8 @@ func NewClient(options ...ClientOption) (*Client, error) {
} }
client.authorizer = authClient client.authorizer = authClient
} }
if client.resolver == nil {
client.resolver = func(ref registry.Reference) (remotes.Resolver, error) { client.resolver = func(ref registry.Reference) (remotes.Resolver, error) {
headers := http.Header{} headers := http.Header{}
headers.Set("User-Agent", version.GetUserAgent()) headers.Set("User-Agent", version.GetUserAgent())
@ -117,6 +119,8 @@ func NewClient(options ...ClientOption) (*Client, error) {
} }
return resolver, nil return resolver, nil
} }
}
// allocate a cache if option is set // allocate a cache if option is set
var cache registryauth.Cache var cache registryauth.Cache
if client.enableCache { if client.enableCache {
@ -202,7 +206,9 @@ func ClientOptPlainHTTP() ClientOption {
// ClientOptResolver returns a function that sets the resolver setting on a client options set // ClientOptResolver returns a function that sets the resolver setting on a client options set
func ClientOptResolver(resolver remotes.Resolver) ClientOption { func ClientOptResolver(resolver remotes.Resolver) ClientOption {
return func(client *Client) { return func(client *Client) {
client.resolver = resolver client.resolver = func(ref registry.Reference) (remotes.Resolver, error) {
return resolver, nil
}
} }
} }

Loading…
Cancel
Save