File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
src/sentry/hybridcloud/apigateway_async Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 88import logging
99from collections .abc import AsyncGenerator , AsyncIterator
1010from urllib .parse import urljoin , urlparse
11- from wsgiref .util import is_hop_by_hop
1211
1312import httpx
1413from asgiref .sync import sync_to_async
@@ -75,8 +74,9 @@ async def _stream_response_and_close(response: httpx.Response) -> AsyncGenerator
7574def _adapt_response (response : httpx .Response , remote_url : str ) -> StreamingHttpResponse :
7675 """Convert an httpx Response into a Django response."""
7776
77+ if content_type := response .headers .get ("Content-Type" , None ):
78+ del response .headers ["Content-Type" ]
7879 new_headers = clean_outbound_headers (response .headers )
79- content_type = new_headers .pop ("Content-Type" , None )
8080
8181 streamed_response = StreamingHttpResponse (
8282 streaming_content = _stream_response_and_close (response ),
@@ -85,8 +85,7 @@ def _adapt_response(response: httpx.Response, remote_url: str) -> StreamingHttpR
8585 )
8686
8787 for header , value in new_headers .items ():
88- if not is_hop_by_hop (header ):
89- streamed_response [header ] = value
88+ streamed_response [header ] = value
9089
9190 streamed_response [PROXY_DIRECT_LOCATION_HEADER ] = remote_url
9291 return streamed_response
You can’t perform that action at this time.
0 commit comments