File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed
Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -290,7 +290,7 @@ async def _request(
290290
291291 response = Response (body = provider_response .content , status = provider_response .status_code )
292292 response_headers = provider_response .headers
293-
293+
294294 _write_response_headers (response , response_headers )
295295
296296 return response
@@ -329,7 +329,8 @@ async def proxy_request(
329329 )
330330
331331 target_url = _url_path_join (provider_base_urls [provider ], remaining_path )
332- headers = {key : value for key , value in request .headers .items () if key != "Host" }
332+ skip_headers = {"host" , "transfer-encoding" }
333+ headers = {key : value for key , value in request .headers .items () if not (key .lower () in skip_headers )}
333334
334335 request_kwargs : Dict [str , Any ] = {
335336 "method" : request .method ,
Original file line number Diff line number Diff line change 1+ ---
2+ fixes :
3+ - |
4+ Ignores the Transfer-Encoding header in proxied vcr requests, forwarding this header can lead to failures in
5+ downstream services.
Original file line number Diff line number Diff line change @@ -195,3 +195,10 @@ async def test_vcr_proxy_does_not_record_ignored_headers(
195195 assert "User-Super-Secret-Api-Key" not in recorded_request ["request" ]["headers" ]
196196 assert "Foo-Bar" not in recorded_request ["request" ]["headers" ]
197197 assert "Authorization" not in recorded_request ["request" ]["headers" ]
198+
199+
200+ async def test_vcr_proxy_with_chunked_request (agent : TestClient [Any , Any ], vcr_cassettes_directory : str ) -> None :
201+ resp = await agent .post ("/vcr/custom/serve" , json = {"foo" : "bar" }, chunked = True )
202+
203+ assert resp .status == 200
204+ assert await resp .text () == "OK"
You can’t perform that action at this time.
0 commit comments