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 @@ -76,9 +76,8 @@ def __stream__(self) -> Iterator[_T]:
7676
7777 yield process_data (data = data , cast_to = cast_to , response = response )
7878
79- # Ensure the entire stream is consumed
80- for _sse in iterator :
81- ...
79+ # As we might not fully consume the response stream, we need to close it explicitly
80+ response .close ()
8281
8382 def __enter__ (self ) -> Self :
8483 return self
@@ -158,9 +157,8 @@ async def __stream__(self) -> AsyncIterator[_T]:
158157
159158 yield process_data (data = data , cast_to = cast_to , response = response )
160159
161- # Ensure the entire stream is consumed
162- async for _sse in iterator :
163- ...
160+ # As we might not fully consume the response stream, we need to close it explicitly
161+ await response .aclose ()
164162
165163 async def __aenter__ (self ) -> Self :
166164 return self
You can’t perform that action at this time.
0 commit comments