Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adapt byte content for StreamingResponse
Fixes #14156 ``` TypeError: 'bytes' object is not an iterator File "starlette/middleware/base.py", line 69, in __call__ await response(scope, receive, send) File "starlette/responses.py", line 260, in __call__ await wrap(partial(self.listen_for_disconnect, receive)) File "anyio/_backends/_asyncio.py", line 662, in __aexit__ raise exceptions[0] File "starlette/responses.py", line 256, in wrap await func() File "starlette/responses.py", line 245, in stream_response async for chunk in self.body_iterator: File "starlette/middleware/base.py", line 58, in body_stream raise app_exc File "starlette/middleware/base.py", line 36, in coro await self.app(scope, request.receive, send_stream.send) File "starlette/exceptions.py", line 93, in __call__ raise exc File "starlette/exceptions.py", line 82, in __call__ await self.app(scope, receive, sender) File "fastapi/middleware/asyncexitstack.py", line 21, in __call__ raise e File "fastapi/middleware/asyncexitstack.py", line 18, in __call__ await self.app(scope, receive, send) File "starlette/routing.py", line 670, in __call__ await route.handle(scope, receive, send) File "starlette/routing.py", line 266, in handle await self.app(scope, receive, send) File "starlette/routing.py", line 68, in app await response(scope, receive, send) File "starlette/responses.py", line 260, in __call__ await wrap(partial(self.listen_for_disconnect, receive)) File "anyio/_backends/_asyncio.py", line 662, in __aexit__ raise exceptions[0] File "starlette/responses.py", line 256, in wrap await func() File "starlette/responses.py", line 245, in stream_response async for chunk in self.body_iterator: File "starlette/concurrency.py", line 63, in iterate_in_threadpool yield await anyio.to_thread.run_sync(_next, iterator) File "anyio/to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "anyio/_backends/_asyncio.py", line 867, in run result = context.run(func, *args) File "starlette/concurrency.py", line 53, in _next return next(iterator) ```
- Loading branch information