Handle UnicodeDecodeError in log_http_response

Similar to commit dec9c9f35 and log_curl_request,
this ignores decoding errors when logging response
headers by passing errors='ignore' to safe_encode.

Change-Id: Ic915a7d8334e9473f300c9db670a3a8f5cda8976
Closes-Bug: #1369756
This commit is contained in:
Matt Riedemann
2014-09-15 14:55:28 -07:00
parent 4a5903bce7
commit ba19a534b7
2 changed files with 12 additions and 1 deletions
+2 -1
View File
@@ -130,7 +130,8 @@ class HTTPClient(object):
if body:
body = strutils.safe_decode(body)
dump.extend([body, ''])
LOG.debug('\n'.join([strutils.safe_encode(x) for x in dump]))
LOG.debug('\n'.join([strutils.safe_encode(x, errors='ignore')
for x in dump]))
@staticmethod
def encode_headers(headers):