@@ -62,18 +62,22 @@ func (s *DefaultClientUtilsImpl) MakeRawBackplaneAPIClientWithAccessToken(base,
6262// makeRawBackplaneAPIClientWithAccessTokenCustomProxy creates a BackplaneApi.ClientInterface with a custom proxy url
6363// proxyURL is optional, the default behavior is no proxy.
6464func makeRawBackplaneAPIClientWithAccessTokenCustomProxy (server string , accessToken string , proxyURL string ) (BackplaneApi.ClientInterface , error ) {
65- co := makeClientOptions (accessToken )
65+ clientOpts := makeClientOptions (accessToken )
6666
6767 if proxyURL != "" {
68- proxy , err := url . Parse (proxyURL )
68+ httpClient , err := httpDoerWithProxy (proxyURL )
6969 if err != nil {
70- return nil , err
70+ return nil , fmt . Errorf ( "failed to create http client: %w" , err )
7171 }
72- http .DefaultTransport = & http.Transport {Proxy : http .ProxyURL (proxy )}
7372 logger .Debugf ("Using backplane Proxy URL: %s\n " , proxyURL )
73+
74+ return BackplaneApi .NewClient (
75+ server ,
76+ clientOpts , BackplaneApi .WithHTTPClient (httpClient ),
77+ )
7478 }
7579
76- return BackplaneApi .NewClient (server , co )
80+ return BackplaneApi .NewClient (server , clientOpts )
7781}
7882
7983func (s * DefaultClientUtilsImpl ) MakeRawBackplaneAPIClient (base string ) (BackplaneApi.ClientInterface , error ) {
@@ -136,3 +140,14 @@ func (s *DefaultClientUtilsImpl) SetClientProxyURL(proxyURL string) error {
136140 s .clientProxyURL = proxyURL
137141 return nil
138142}
143+
144+ func httpDoerWithProxy (proxyURL string ) (* http.Client , error ) {
145+ proxy , err := url .Parse (proxyURL )
146+ if err != nil {
147+ return nil , err
148+ }
149+
150+ return & http.Client {
151+ Transport : & http.Transport {Proxy : http .ProxyURL (proxy )},
152+ }, nil
153+ }
0 commit comments