@@ -144,21 +144,30 @@ def test_redirect_cross_host_remove_headers(self) -> None:
144144 "GET" ,
145145 f"{ self .base_url } /redirect" ,
146146 fields = {"target" : f"{ self .base_url_alt } /headers" },
147- headers = {"Authorization" : "foo" , "Cookie" : "foo=bar" },
147+ headers = {
148+ "Authorization" : "foo" ,
149+ "Proxy-Authorization" : "bar" ,
150+ "Cookie" : "foo=bar" ,
151+ },
148152 )
149153
150154 assert r .status == 200
151155
152156 data = r .json ()
153157
154158 assert "Authorization" not in data
159+ assert "Proxy-Authorization" not in data
155160 assert "Cookie" not in data
156161
157162 r = http .request (
158163 "GET" ,
159164 f"{ self .base_url } /redirect" ,
160165 fields = {"target" : f"{ self .base_url_alt } /headers" },
161- headers = {"authorization" : "foo" , "cookie" : "foo=bar" },
166+ headers = {
167+ "authorization" : "foo" ,
168+ "proxy-authorization" : "baz" ,
169+ "cookie" : "foo=bar" ,
170+ },
162171 )
163172
164173 assert r .status == 200
@@ -167,6 +176,8 @@ def test_redirect_cross_host_remove_headers(self) -> None:
167176
168177 assert "authorization" not in data
169178 assert "Authorization" not in data
179+ assert "proxy-authorization" not in data
180+ assert "Proxy-Authorization" not in data
170181 assert "cookie" not in data
171182 assert "Cookie" not in data
172183
@@ -176,7 +187,11 @@ def test_redirect_cross_host_no_remove_headers(self) -> None:
176187 "GET" ,
177188 f"{ self .base_url } /redirect" ,
178189 fields = {"target" : f"{ self .base_url_alt } /headers" },
179- headers = {"Authorization" : "foo" , "Cookie" : "foo=bar" },
190+ headers = {
191+ "Authorization" : "foo" ,
192+ "Proxy-Authorization" : "bar" ,
193+ "Cookie" : "foo=bar" ,
194+ },
180195 retries = Retry (remove_headers_on_redirect = []),
181196 )
182197
@@ -185,6 +200,7 @@ def test_redirect_cross_host_no_remove_headers(self) -> None:
185200 data = r .json ()
186201
187202 assert data ["Authorization" ] == "foo"
203+ assert data ["Proxy-Authorization" ] == "bar"
188204 assert data ["Cookie" ] == "foo=bar"
189205
190206 def test_redirect_cross_host_set_removed_headers (self ) -> None :
@@ -196,6 +212,7 @@ def test_redirect_cross_host_set_removed_headers(self) -> None:
196212 headers = {
197213 "X-API-Secret" : "foo" ,
198214 "Authorization" : "bar" ,
215+ "Proxy-Authorization" : "baz" ,
199216 "Cookie" : "foo=bar" ,
200217 },
201218 retries = Retry (remove_headers_on_redirect = ["X-API-Secret" ]),
@@ -207,11 +224,13 @@ def test_redirect_cross_host_set_removed_headers(self) -> None:
207224
208225 assert "X-API-Secret" not in data
209226 assert data ["Authorization" ] == "bar"
227+ assert data ["Proxy-Authorization" ] == "baz"
210228 assert data ["Cookie" ] == "foo=bar"
211229
212230 headers = {
213231 "x-api-secret" : "foo" ,
214232 "authorization" : "bar" ,
233+ "proxy-authorization" : "baz" ,
215234 "cookie" : "foo=bar" ,
216235 }
217236 r = http .request (
@@ -229,12 +248,14 @@ def test_redirect_cross_host_set_removed_headers(self) -> None:
229248 assert "x-api-secret" not in data
230249 assert "X-API-Secret" not in data
231250 assert data ["Authorization" ] == "bar"
251+ assert data ["Proxy-Authorization" ] == "baz"
232252 assert data ["Cookie" ] == "foo=bar"
233253
234254 # Ensure the header argument itself is not modified in-place.
235255 assert headers == {
236256 "x-api-secret" : "foo" ,
237257 "authorization" : "bar" ,
258+ "proxy-authorization" : "baz" ,
238259 "cookie" : "foo=bar" ,
239260 }
240261
0 commit comments