File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -260,17 +260,15 @@ func NewAPIClientFromFlags(opts *cliflags.ClientOptions, configFile *configfile.
260260}
261261
262262func newAPIClientFromEndpoint (ep docker.Endpoint , configFile * configfile.ConfigFile ) (client.APIClient , error ) {
263- clientOpts , err := ep .ClientOpts ()
263+ opts , err := ep .ClientOpts ()
264264 if err != nil {
265265 return nil , err
266266 }
267- customHeaders := make (map [string ]string , len (configFile .HTTPHeaders ))
268- for k , v := range configFile .HTTPHeaders {
269- customHeaders [k ] = v
267+ if len (configFile .HTTPHeaders ) > 0 {
268+ opts = append (opts , client .WithHTTPHeaders (configFile .HTTPHeaders ))
270269 }
271- customHeaders ["User-Agent" ] = UserAgent ()
272- clientOpts = append (clientOpts , client .WithHTTPHeaders (customHeaders ))
273- return client .NewClientWithOpts (clientOpts ... )
270+ opts = append (opts , client .WithUserAgent (UserAgent ()))
271+ return client .NewClientWithOpts (opts ... )
274272}
275273
276274func resolveDockerEndpoint (s store.Reader , contextName string ) (docker.Endpoint , error ) {
You can’t perform that action at this time.
0 commit comments