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__(
78
78
self .proxy_uri : str = proxy
79
79
self .host = parsed .hostname
80
80
self .port = parsed .port
81
- self .proxy_auth = self .basic_proxy_auth_header (parsed )
81
+ self .proxy_auth = self .basic_proxy_auth_headers (parsed )
82
82
else :
83
83
self .realhost = self .realport = self .proxy_auth = None
84
84
@@ -167,7 +167,7 @@ def flush(self):
167
167
}
168
168
169
169
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 )
171
171
172
172
if self .__custom_headers :
173
173
custom_headers = {key : val for key , val in self .__custom_headers .items ()}
@@ -190,7 +190,7 @@ def flush(self):
190
190
self .headers = self .__resp .headers
191
191
192
192
@staticmethod
193
- def basic_proxy_auth_header (proxy ):
193
+ def basic_proxy_auth_headers (proxy ):
194
194
if proxy is None or not proxy .username :
195
195
return None
196
196
ap = "%s:%s" % (
Original file line number Diff line number Diff line change @@ -167,11 +167,12 @@ def test_proxy_headers_are_set(self):
167
167
parsed_proxy = urlparse (fake_proxy_spec )
168
168
169
169
try :
170
- result = THttpClient .basic_proxy_auth_header (parsed_proxy )
170
+ result = THttpClient .basic_proxy_auth_headers (parsed_proxy )
171
171
except TypeError as e :
172
172
assert False
173
173
174
- assert isinstance (result , type (str ()))
174
+ assert isinstance (result , type (dict ()))
175
+ assert isinstance (result .get ('proxy-authorization' ), type (str ()))
175
176
176
177
@patch ("databricks.sql.auth.thrift_http_client.THttpClient" )
177
178
@patch ("databricks.sql.thrift_backend.create_default_context" )
You can’t perform that action at this time.
0 commit comments