9a072adf | package client import ( "crypto/tls" "net/http" ) // transportFunc allows us to inject a mock transport for testing. We define it // here so we can detect the tlsconfig and return nil for only this type. type transportFunc func(*http.Request) (*http.Response, error) func (tf transportFunc) RoundTrip(req *http.Request) (*http.Response, error) { return tf(req) } |
113cae5b | // resolveTLSConfig attempts to resolve the TLS configuration from the |
9a072adf | // RoundTripper. |
dc9f5c2c | func resolveTLSConfig(transport http.RoundTripper) *tls.Config { |
9a072adf | switch tr := transport.(type) { case *http.Transport: |
dc9f5c2c | return tr.TLSClientConfig |
9a072adf | default: |
dc9f5c2c | return nil |
9a072adf | } } |