[BUG] using yield in route
See original GitHub issueDescribe the bug
I am not sure if it is a bug, or a feature request. Perhaps using yield in a route is not intended by fastapi.
To Reproduce
- Create a file with:
@app.get("/")
async def root():
print('hello')
yield JSONResponse({'some': 'text'})
print('world')
- Open the browser and call the endpoint
/
.
Expected behaviour
The {‘some’: ‘text’} as json.
Screenshots
But this is what I get.
Environment
- Linux Mint 19
- Fastapi 0.54.1
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Bug Symfony Can use "yield from" only with arrays
Can use "yield from" only with arrays and Traversables If I modify anything in my "Entities" entity then symfony sends me back:.
Read more >Bug Type - Loomian Legacy Wiki - Fandom
There are currently 24 Loomians that are Bug-type, of which nine are pure and 15 are ... ID, Sprite, Name, Type, Earliest Obtaining...
Read more >Trade Route Bug
Once I did that, Trade routes started incrementing by 1 again per commercial center (but they don't reset to the correct value).
Read more >Confirmed from livestream, Poundmakers trade route reverse ...
... Poundmakers trade route reverse yield bug is getting fixed. Cant wait to get back to making crazy pasture city and growing my...
Read more >Mastering RouterLink
params in the Item component will yield {bar: 'baz'} (along with {id: 1} since the named parameter :id is also defined on that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tiangolo Just out of interest. Do you consider supporting yield as response?
If you want to do something after send a response. You can try background task