cloudflare_dns: handle exhausted response stream in case of http error (#9818)

* cloudflare_dns: handle exhausted response stream in case of http error

* Update changelogs/fragments/9818-cloudflare-dns-exhausted-response.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Kristian Heljas
2025-03-03 07:56:11 +02:00
committed by GitHub
parent e39320c354
commit 3b6efd5cbc
2 changed files with 5 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
bugfixes:
- cloudlare_dns - handle exhausted response stream in case of HTTP errors to show nice error message to the user (https://github.com/ansible-collections/community.general/issues/9782, https://github.com/ansible-collections/community.general/pull/9818).

View File

@@ -551,6 +551,9 @@ class CloudflareAPI(object):
try:
content = resp.read()
except AttributeError:
content = None
if not content:
if info['body']:
content = info['body']
else: