@@ -90,25 +90,30 @@ type ClientOpts struct {
9090 OAuthToken * oauthdevice.Token
9191}
9292
93- func buildTransport (opts ClientOpts , flags * Flags ) * http.Transport {
94- transport := http .DefaultTransport .(* http.Transport ).Clone ()
93+ func buildTransport (opts ClientOpts , flags * Flags ) http.RoundTripper {
94+ var transport http.RoundTripper
95+ {
96+ tp := http .DefaultTransport .(* http.Transport ).Clone ()
9597
96- if flags .insecureSkipVerify != nil && * flags .insecureSkipVerify {
97- transport .TLSClientConfig = & tls.Config {InsecureSkipVerify : true }
98- }
98+ if flags .insecureSkipVerify != nil && * flags .insecureSkipVerify {
99+ tp .TLSClientConfig = & tls.Config {InsecureSkipVerify : true }
100+ }
99101
100- if transport .TLSClientConfig == nil {
101- transport .TLSClientConfig = & tls.Config {}
102- }
102+ if tp .TLSClientConfig == nil {
103+ tp .TLSClientConfig = & tls.Config {}
104+ }
105+
106+ if opts .ProxyURL != nil || opts .ProxyPath != "" {
107+ tp = withProxyTransport (tp , opts .ProxyURL , opts .ProxyPath )
108+ }
103109
104- if opts .ProxyURL != nil || opts .ProxyPath != "" {
105- transport = withProxyTransport (transport , opts .ProxyURL , opts .ProxyPath )
110+ transport = tp
106111 }
107112
108- if opt .AccessToken == "" && opt .OAuthToken != nil {
113+ if opts .AccessToken == "" && opts .OAuthToken != nil {
109114 transport = & oauthdevice.Transport {
110- Base : transport ,
111- Token : opts .OAuthToken
115+ Base : transport ,
116+ Token : opts .OAuthToken ,
112117 }
113118 }
114119
0 commit comments