Add debug log of response content type, status code and encoding
Change-Id: Ib262008728c6c884a5f8fb28f66fa7595d1254ef
David Pursehouse
5 years ago
53 | 53 | requests.HTTPError if the response contains an HTTP error status code. |
54 | 54 | |
55 | 55 | """ |
56 | content_type = response.headers.get('content-type', '') | |
57 | logger.debug("status[%s] content_type[%s] encoding[%s]" % | |
58 | (response.status_code, content_type, response.encoding)) | |
56 | 59 | content = response.content.strip() |
57 | 60 | if response.encoding: |
58 | 61 | content = content.decode(response.encoding) |
59 | 62 | response.raise_for_status() |
60 | content_type = response.headers.get('content-type', '') | |
61 | 63 | if content_type.split(';')[0] != 'application/json': |
62 | 64 | return content |
63 | 65 | if content.startswith(GERRIT_MAGIC_JSON_PREFIX): |