File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -57,9 +57,8 @@ def __stream__(self) -> Iterator[_T]:
5757 for sse in iterator :
5858 yield process_data (data = sse .json (), cast_to = cast_to , response = response )
5959
60- # Ensure the entire stream is consumed
61- for _sse in iterator :
62- ...
60+ # As we might not fully consume the response stream, we need to close it explicitly
61+ response .close ()
6362
6463 def __enter__ (self ) -> Self :
6564 return self
@@ -121,9 +120,8 @@ async def __stream__(self) -> AsyncIterator[_T]:
121120 async for sse in iterator :
122121 yield process_data (data = sse .json (), cast_to = cast_to , response = response )
123122
124- # Ensure the entire stream is consumed
125- async for _sse in iterator :
126- ...
123+ # As we might not fully consume the response stream, we need to close it explicitly
124+ await response .aclose ()
127125
128126 async def __aenter__ (self ) -> Self :
129127 return self
You can’t perform that action at this time.
0 commit comments