def test_post_max_client_size(loop, test_client):
@asyncio.coroutine
def handler(request):
try:
yield from request.post()
except ValueError:
return web.HTTPOk()
return web.HTTPBadRequest()
app = web.Application(client_max_size=10)
app.router.add_post('/', handler)
client = yield from test_client(app)
data = {"long_string": 1024 * 'x', 'file': io.BytesIO(b'test')}
resp = yield from client.post('/', data=data)
assert 200 == resp.status
评论列表
文章目录