From 485a679f3e87d5e38a72c4da07f5fb3ecd6597c8 Mon Sep 17 00:00:00 2001 From: rabi Date: Fri, 2 Jun 2017 10:43:25 +0530 Subject: Decode content before checking Decode before checking for py3 compatibility. Change-Id: Ic62ebc385146ab1406dd64384044d92be8171052 Related-Bug: #1695144 --- heatclient/common/http.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'heatclient/common') diff --git a/heatclient/common/http.py b/heatclient/common/http.py index f5c5021..4b765df 100644 --- a/heatclient/common/http.py +++ b/heatclient/common/http.py @@ -221,10 +221,10 @@ class HTTPClient(object): raise exc.CommunicationError(message=message) self.log_http_response(resp) - + txt_content = encodeutils.safe_decode(resp.content, 'utf-8') if not ('X-Auth-Key' in kwargs['headers']) and ( resp.status_code == 401 or - (resp.status_code == 500 and "(HTTP 401)" in resp.content)): + (resp.status_code == 500 and "(HTTP 401)" in txt_content)): raise exc.HTTPUnauthorized(_("Authentication failed: %s") % resp.content) elif 400 <= resp.status_code < 600: -- cgit v1.2.1