Skip to content

Commit

Permalink
fix ensure_next read first chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
abersheeran committed Jul 26, 2024
1 parent 27f93ab commit 3635cc3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions baize/wsgi/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ def stream(self, chunk_size: int = 4096 * 16) -> Iterator[bytes]:


def ensure_next(iterable: Iterable[bytes]) -> Iterable[bytes]:
yield iterable.__iter__().__next__()
yield from iterable
first_chunk = iterable.__iter__().__next__()

def generator():
yield first_chunk
yield from iterable

return generator()


class NextResponse(StreamingResponse):
Expand Down

0 comments on commit 3635cc3

Please sign in to comment.