File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ def __init__(
7878 self .proxy_uri : str = proxy
7979 self .host = parsed .hostname
8080 self .port = parsed .port
81- self .proxy_auth = self .basic_proxy_auth_header (parsed )
81+ self .proxy_auth = self .basic_proxy_auth_headers (parsed )
8282 else :
8383 self .realhost = self .realport = self .proxy_auth = None
8484
@@ -167,7 +167,7 @@ def flush(self):
167167 }
168168
169169 if self .using_proxy () and self .scheme == "http" and self .proxy_auth is not None :
170- headers [ "Proxy-Authorization" : self .proxy_auth ]
170+ headers . update ( self .proxy_auth )
171171
172172 if self .__custom_headers :
173173 custom_headers = {key : val for key , val in self .__custom_headers .items ()}
@@ -190,7 +190,7 @@ def flush(self):
190190 self .headers = self .__resp .headers
191191
192192 @staticmethod
193- def basic_proxy_auth_header (proxy ):
193+ def basic_proxy_auth_headers (proxy ):
194194 if proxy is None or not proxy .username :
195195 return None
196196 ap = "%s:%s" % (
Original file line number Diff line number Diff line change @@ -167,11 +167,12 @@ def test_proxy_headers_are_set(self):
167167 parsed_proxy = urlparse (fake_proxy_spec )
168168
169169 try :
170- result = THttpClient .basic_proxy_auth_header (parsed_proxy )
170+ result = THttpClient .basic_proxy_auth_headers (parsed_proxy )
171171 except TypeError as e :
172172 assert False
173173
174- assert isinstance (result , type (str ()))
174+ assert isinstance (result , type (dict ()))
175+ assert isinstance (result .get ('proxy-authorization' ), type (str ()))
175176
176177 @patch ("databricks.sql.auth.thrift_http_client.THttpClient" )
177178 @patch ("databricks.sql.thrift_backend.create_default_context" )
You can’t perform that action at this time.
0 commit comments