Merge branch 'master' into streaming
This commit is contained in:
@@ -546,6 +546,13 @@ def test_request_stream(app):
|
||||
assert response.text == data
|
||||
|
||||
def test_streaming_new_api(app):
|
||||
@app.post("/non-stream")
|
||||
async def handler(request):
|
||||
assert request.body == b"x"
|
||||
await request.receive_body() # This should do nothing
|
||||
assert request.body == b"x"
|
||||
return text("OK")
|
||||
|
||||
@app.post("/1", stream=True)
|
||||
async def handler(request):
|
||||
assert request.stream
|
||||
@@ -563,6 +570,9 @@ def test_streaming_new_api(app):
|
||||
ret.append(data.decode("ASCII"))
|
||||
return json(ret)
|
||||
|
||||
request, response = app.test_client.post("/non-stream", data="x")
|
||||
assert response.status == 200
|
||||
|
||||
request, response = app.test_client.post("/1", data="TEST data")
|
||||
assert request.body == b"TEST data"
|
||||
assert response.status == 200
|
||||
|
||||
Reference in New Issue
Block a user