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 if sse .event is None :
7777 yield process_data (data = sse .json (), 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
@@ -159,9 +158,8 @@ async def __stream__(self) -> AsyncIterator[_T]:
159158 if sse .event is None :
160159 yield process_data (data = sse .json (), cast_to = cast_to , response = response )
161160
162- # Ensure the entire stream is consumed
163- async for _sse in iterator :
164- ...
161+ # As we might not fully consume the response stream, we need to close it explicitly
162+ await response .aclose ()
165163
166164 async def __aenter__ (self ) -> Self :
167165 return self
You can’t perform that action at this time.
0 commit comments