| 21 | """Each body chunk is delivered as sent, empty chunks are skipped, and the stream ends with the application.""" |
| 22 | |
| 23 | async def chunked_app(scope: Scope, receive: Receive, send: Send) -> None: |
| 24 | assert scope["type"] == "http" |
| 25 | assert (await receive())["type"] == "http.request" |
| 26 | await send({"type": "http.response.start", "status": 200, "headers": [(b"content-type", b"text/plain")]}) |
| 27 | await send({"type": "http.response.body", "body": b"first", "more_body": True}) |
| 28 | await send({"type": "http.response.body", "body": b"", "more_body": True}) |
| 29 | await send({"type": "http.response.body", "body": b"second", "more_body": False}) |
| 30 | |
| 31 | async with ( |
| 32 | httpx.AsyncClient(transport=StreamingASGITransport(chunked_app), base_url="http://bridge") as http, |