From 3a13c9c18308be35648fc93a41105a9978847b17 Mon Sep 17 00:00:00 2001 From: iscai-msft <43154838+iscai-msft@users.noreply.github.com> Date: Wed, 29 Sep 2021 20:20:25 -0400 Subject: [PATCH] [rest] fix aiohttp read in rest (#20952) --- sdk/core/azure-core/CHANGELOG.md | 2 +- sdk/core/azure-core/azure/core/rest/_aiohttp.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index 7511f280da26..bb129a0e8b3c 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.19.0 (Unreleased) +## 1.19.0 (2021-09-30) ### Features Added diff --git a/sdk/core/azure-core/azure/core/rest/_aiohttp.py b/sdk/core/azure-core/azure/core/rest/_aiohttp.py index 67ea2346747b..363489dd11f8 100644 --- a/sdk/core/azure-core/azure/core/rest/_aiohttp.py +++ b/sdk/core/azure-core/azure/core/rest/_aiohttp.py @@ -171,6 +171,18 @@ def __getstate__(self): state['headers'] = CIMultiDict(self.headers) # MultiDictProxy is not pickable return state + async def read(self) -> bytes: + """Read the response's bytes into memory. + + :return: The response's bytes + :rtype: bytes + """ + if not self._content: + self._stream_download_check() + self._content = await self._internal_response.read() + await self._set_read_checks() + return _aiohttp_body_helper(self) + async def close(self) -> None: """Close the response.