File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,9 +87,8 @@ def __stream__(self) -> Iterator[_T]:
8787
8888 yield process_data (data = sse .json (), cast_to = cast_to , response = response )
8989
90- # Ensure the entire stream is consumed
91- for _sse in iterator :
92- ...
90+ # As we might not fully consume the response stream, we need to close it explicitly
91+ response .close ()
9392
9493 def __enter__ (self ) -> Self :
9594 return self
@@ -162,9 +161,8 @@ async def __stream__(self) -> AsyncIterator[_T]:
162161
163162 yield process_data (data = sse .json (), cast_to = cast_to , response = response )
164163
165- # Ensure the entire stream is consumed
166- async for _sse in iterator :
167- ...
164+ # As we might not fully consume the response stream, we need to close it explicitly
165+ await response .aclose ()
168166
169167 async def __aenter__ (self ) -> Self :
170168 return self
You can’t perform that action at this time.
0 commit comments