| 88 | |
| 89 | @pytest.mark.anyio |
| 90 | async def test_aread_and_stream_data(): |
| 91 | # Ensure a request may still be streamed if it has been read. |
| 92 | # Needed for cases such as authentication classes that read the request body. |
| 93 | request = httpx.Request("POST", "http://example.org", json={"test": 123}) |
| 94 | await request.aread() |
| 95 | assert request.stream is not None |
| 96 | assert isinstance(request.stream, typing.AsyncIterable) |
| 97 | content = b"".join([part async for part in request.stream]) |
| 98 | assert content == request.content |
| 99 | |
| 100 | |
| 101 | def test_cannot_access_streaming_content_without_read(): |