MCPcopy
hub / github.com/encode/httpx / test_aread_and_stream_data

Function test_aread_and_stream_data

tests/models/test_requests.py:90–98  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

88
89@pytest.mark.anyio
90async 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
101def test_cannot_access_streaming_content_without_read():

Callers

nothing calls this directly

Calls 2

areadMethod · 0.95
joinMethod · 0.80

Tested by

no test coverage detected