Mergeback of 21.12.1 (#2358)

Co-authored-by: Néstor Pérez <25409753+prryplatypus@users.noreply.github.com>
Co-authored-by: Ryu juheon <saidbysolo@gmail.com>
This commit is contained in:
Adam Hopkins
2022-01-06 12:40:52 +02:00
committed by GitHub
parent 9bf9067c99
commit 4669036f45
19 changed files with 142 additions and 46 deletions

View File

@@ -62,19 +62,15 @@ def test_streaming_body_requests(app):
data = ["hello", "world"]
class Data(AsyncByteStream):
def __init__(self, data):
self.data = data
async def __aiter__(self):
for value in self.data:
yield value.encode("utf-8")
client = ReusableClient(app, port=1234)
async def stream(data):
for value in data:
yield value.encode("utf-8")
with client:
_, response1 = client.post("/", data=Data(data))
_, response2 = client.post("/", data=Data(data))
_, response1 = client.post("/", data=stream(data))
_, response2 = client.post("/", data=stream(data))
assert response1.status == response2.status == 200
assert response1.json["data"] == response2.json["data"] == data