An `async` task can only be cancelled when it reaches an `await`. If there is no `await`, the generator (function with `yield`) can not be cancelled properly and may keep running even after cancellation is requested.
Since this small example does not need any `await` statements, we add an `await anyio.sleep(0)` to give the event loop a chance to handle cancellation.
This would be even more important with large or infinite streams.
///
#### Using `StreamingResponse` with file-like objects { #using-streamingresponse-with-file-like-objects }