Skip to content

Commit

Permalink
do not compare against defaulttransport
Browse files Browse the repository at this point in the history
  • Loading branch information
kokes committed Jan 28, 2025
1 parent e69e8cf commit 76b7202
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ func hasCustomTransport(hc *http.Client) bool {
if hc == nil || hc.Transport == nil {
return false
}
if hc.Transport != http.DefaultTransport.(*http.Transport) {
if _, ok := hc.Transport.(*http.Transport); !ok {
log.Println("[WARN] Custom transport is not allowed with a custom root CA.")
return true
}
Expand Down
5 changes: 0 additions & 5 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -597,17 +597,12 @@ func TestClient_CustomRootCAWithoutCustomRoundTripper(t *testing.T) {
}

for _, test := range tests {
if test.name != "set CA, use timeout" {
continue
}
t.Run(test.name, func(t *testing.T) {
if test.setCA {
t.Setenv(APIHostCert, caFile.Name())
}

client := NewClient(test.httpClient)
t.Logf("YALLO: %v", test.httpClient.Transport == http.DefaultTransport)

transport, err := client.resty.Transport()
if err != nil {
t.Fatal(err)
Expand Down

0 comments on commit 76b7202

Please sign in to comment.