Commit 2a0915e
committed
Fix: Need to read full message, can't return streaming
This fixes errors that looked like this:
Traceback (most recent call last):
File "/opt/miniconda3/envs/swea13/lib/python3.13/site-packages/uvicorn/protocols/http/h11_impl.py", line 406, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
self.scope, self.receive, self.send
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/opt/miniconda3/envs/swea13/lib/python3.13/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda3/envs/swea13/lib/python3.13/site-packages/fastapi/applications.py", line 1054, in __call__
await super().__call__(scope, receive, send)
File "/opt/miniconda3/envs/swea13/lib/python3.13/site-packages/starlette/applications.py", line 113, in __call__
await self.middleware_stack(scope, receive, send)
File "/opt/miniconda3/envs/swea13/lib/python3.13/site-packages/starlette/middleware/errors.py", line 187, in __call__
raise exc
File "/opt/miniconda3/envs/swea13/lib/python3.13/site-packages/starlette/middleware/errors.py", line 165, in __call__
await self.app(scope, receive, _send)
File "/opt/miniconda3/envs/swea13/lib/python3.13/site-packages/starlette/middleware/base.py", line 185, in __call__
with collapse_excgroups():
~~~~~~~~~~~~~~~~~~^^
File "/opt/miniconda3/envs/swea13/lib/python3.13/contextlib.py", line 162, in __exit__
self.gen.throw(value)
~~~~~~~~~~~~~~^^^^^^^
File "/opt/miniconda3/envs/swea13/lib/python3.13/site-packages/starlette/_utils.py", line 82, in collapse_excgroups
raise exc
File "/opt/miniconda3/envs/swea13/lib/python3.13/site-packages/starlette/middleware/base.py", line 187, in __call__
response = await self.dispatch_func(request, call_next)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/fuchur/Documents/24/git_sync/swe-rex/src/swerex/server.py", line 92, in handle_request_id
new_response = Response(
content=body_stream(),
...<2 lines>...
media_type=response.media_type,
)
File "/opt/miniconda3/envs/swea13/lib/python3.13/site-packages/starlette/responses.py", line 43, in __init__
self.body = self.render(content)
~~~~~~~~~~~^^^^^^^^^
File "/opt/miniconda3/envs/swea13/lib/python3.13/site-packages/starlette/responses.py", line 51, in render
return content.encode(self.charset) # type: ignore
^^^^^^^^^^^^^^
AttributeError: 'async_generator' object has no attribute 'encode'1 parent f99d8c2 commit 2a0915e
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | | - | |
90 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
0 commit comments