@@ -141,20 +141,21 @@ def test_redirect_cross_host_remove_headers(self):
141141 "GET" ,
142142 "%s/redirect" % self .base_url ,
143143 fields = {"target" : "%s/headers" % self .base_url_alt },
144- headers = {"Authorization" : "foo" },
144+ headers = {"Authorization" : "foo" , "Cookie" : "foo=bar" },
145145 )
146146
147147 assert r .status == 200
148148
149149 data = json .loads (r .data .decode ("utf-8" ))
150150
151151 assert "Authorization" not in data
152+ assert "Cookie" not in data
152153
153154 r = http .request (
154155 "GET" ,
155156 "%s/redirect" % self .base_url ,
156157 fields = {"target" : "%s/headers" % self .base_url_alt },
157- headers = {"authorization" : "foo" },
158+ headers = {"authorization" : "foo" , "cookie" : "foo=bar" },
158159 )
159160
160161 assert r .status == 200
@@ -163,14 +164,16 @@ def test_redirect_cross_host_remove_headers(self):
163164
164165 assert "authorization" not in data
165166 assert "Authorization" not in data
167+ assert "cookie" not in data
168+ assert "Cookie" not in data
166169
167170 def test_redirect_cross_host_no_remove_headers (self ):
168171 with PoolManager () as http :
169172 r = http .request (
170173 "GET" ,
171174 "%s/redirect" % self .base_url ,
172175 fields = {"target" : "%s/headers" % self .base_url_alt },
173- headers = {"Authorization" : "foo" },
176+ headers = {"Authorization" : "foo" , "Cookie" : "foo=bar" },
174177 retries = Retry (remove_headers_on_redirect = []),
175178 )
176179
@@ -179,14 +182,19 @@ def test_redirect_cross_host_no_remove_headers(self):
179182 data = json .loads (r .data .decode ("utf-8" ))
180183
181184 assert data ["Authorization" ] == "foo"
185+ assert data ["Cookie" ] == "foo=bar"
182186
183187 def test_redirect_cross_host_set_removed_headers (self ):
184188 with PoolManager () as http :
185189 r = http .request (
186190 "GET" ,
187191 "%s/redirect" % self .base_url ,
188192 fields = {"target" : "%s/headers" % self .base_url_alt },
189- headers = {"X-API-Secret" : "foo" , "Authorization" : "bar" },
193+ headers = {
194+ "X-API-Secret" : "foo" ,
195+ "Authorization" : "bar" ,
196+ "Cookie" : "foo=bar" ,
197+ },
190198 retries = Retry (remove_headers_on_redirect = ["X-API-Secret" ]),
191199 )
192200
@@ -196,12 +204,17 @@ def test_redirect_cross_host_set_removed_headers(self):
196204
197205 assert "X-API-Secret" not in data
198206 assert data ["Authorization" ] == "bar"
207+ assert data ["Cookie" ] == "foo=bar"
199208
200209 r = http .request (
201210 "GET" ,
202211 "%s/redirect" % self .base_url ,
203212 fields = {"target" : "%s/headers" % self .base_url_alt },
204- headers = {"x-api-secret" : "foo" , "authorization" : "bar" },
213+ headers = {
214+ "x-api-secret" : "foo" ,
215+ "authorization" : "bar" ,
216+ "cookie" : "foo=bar" ,
217+ },
205218 retries = Retry (remove_headers_on_redirect = ["X-API-Secret" ]),
206219 )
207220
@@ -212,6 +225,7 @@ def test_redirect_cross_host_set_removed_headers(self):
212225 assert "x-api-secret" not in data
213226 assert "X-API-Secret" not in data
214227 assert data ["Authorization" ] == "bar"
228+ assert data ["Cookie" ] == "foo=bar"
215229
216230 def test_redirect_without_preload_releases_connection (self ):
217231 with PoolManager (block = True , maxsize = 2 ) as http :
0 commit comments