Skip to content

Commit c04088e

Browse files
committed
feat(round-trip): add DebuggWrapper for http client
1 parent c2ae4cd commit c04088e

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

cmd/adapter/adapter.go

+18-12
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,9 @@ func makeKubeconfigHTTPClient(inClusterAuth bool, kubeConfigPath string) (*http.
393393

394394
// return the default client if we're using no auth
395395
if !inClusterAuth && kubeConfigPath == "" {
396-
return http.DefaultClient, nil
396+
return &http.Client{
397+
Transport: transport.DebugWrappers(http.DefaultTransport),
398+
}, nil
397399
}
398400

399401
var authConf *rest.Config
@@ -436,23 +438,27 @@ func makePrometheusCAClient(caFilePath string, tlsCertFilePath string, tlsKeyFil
436438
return nil, fmt.Errorf("failed to read TLS key pair: %v", err)
437439
}
438440
return &http.Client{
439-
Transport: &http.Transport{
440-
TLSClientConfig: &tls.Config{
441-
RootCAs: pool,
442-
Certificates: []tls.Certificate{tlsClientCerts},
443-
MinVersion: tls.VersionTLS12,
441+
Transport: transport.DebugWrappers(
442+
&http.Transport{
443+
TLSClientConfig: &tls.Config{
444+
RootCAs: pool,
445+
Certificates: []tls.Certificate{tlsClientCerts},
446+
MinVersion: tls.VersionTLS12,
447+
},
444448
},
445-
},
449+
),
446450
}, nil
447451
}
448452

449453
return &http.Client{
450-
Transport: &http.Transport{
451-
TLSClientConfig: &tls.Config{
452-
RootCAs: pool,
453-
MinVersion: tls.VersionTLS12,
454+
Transport: transport.DebugWrappers(
455+
&http.Transport{
456+
TLSClientConfig: &tls.Config{
457+
RootCAs: pool,
458+
MinVersion: tls.VersionTLS12,
459+
},
454460
},
455-
},
461+
),
456462
}, nil
457463
}
458464

0 commit comments

Comments
 (0)