From 9f255dfa397a5f5c3bc3e885abcdc0b0e5a516d7 Mon Sep 17 00:00:00 2001 From: AdrienDucourthial Date: Mon, 27 May 2024 11:46:01 +0200 Subject: [PATCH] improve bug fix of content-type in case of bad authentication --- plugins/module_utils/horizon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/module_utils/horizon.py b/plugins/module_utils/horizon.py index cec4819..b3a1346 100644 --- a/plugins/module_utils/horizon.py +++ b/plugins/module_utils/horizon.py @@ -479,7 +479,7 @@ def send(self, method, path, **kwargs): except requests.exceptions.SSLError: raise AnsibleError("Got an SSL error try using the 'ca_bundle' paramater") - if ('Content-Type' in response.headers and response.headers['Content-Type'] == 'application/json') or response.status_code >= 400: + if 'Content-Type' in response.headers and response.headers['Content-Type'] in ['application/json', 'application/problem+json']: content = response.json() else: content = response.content.decode()