From 4d9e4d8fe8b4615da6a92696b29c7ee193dc7fb7 Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Wed, 11 Dec 2019 02:07:26 +0000 Subject: [PATCH] Fix ClientResponse._read returning more than nbytes if the entire response fits into the first block fed into the parser --- qwarc/aiohttp.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qwarc/aiohttp.py b/qwarc/aiohttp.py index 540376d..e8199ec 100644 --- a/qwarc/aiohttp.py +++ b/qwarc/aiohttp.py @@ -147,6 +147,8 @@ class ClientResponse(aiohttp.client_reqrep.ClientResponse): if payload.exc: raise Exception from payload.exc + if nbytes is not None: + return payload.data.getvalue()[:nbytes] return payload.data.getvalue() async def read(self, nbytes = None):