diff --git a/kubernetes_asyncio/client/api_client.py b/kubernetes_asyncio/client/api_client.py index 4e552a6ae..34535c0ac 100644 --- a/kubernetes_asyncio/client/api_client.py +++ b/kubernetes_asyncio/client/api_client.py @@ -188,8 +188,6 @@ async def __call_api( e.body = e.body.decode('utf-8') if six.PY3 else e.body raise e - content_type = response_data.getheader('content-type') - self.last_response = response_data return_data = response_data @@ -199,6 +197,7 @@ async def __call_api( if six.PY3 and response_type not in ["file", "bytes"]: match = None + content_type = response_data.getheader('content-type') if content_type is not None: match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type) encoding = match.group(1) if match else "utf-8"