Codebase list python-pygerrit2 / 29a7607
Raise exception for error status before attempting to parse content Change-Id: I52041f3795f7ee8962aa1a69e9a2fd7e100ccc8a David Pursehouse 5 years ago
1 changed file(s) with 1 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
5656 content_type = response.headers.get('content-type', '')
5757 logger.debug("status[%s] content_type[%s] encoding[%s]" %
5858 (response.status_code, content_type, response.encoding))
59 response.raise_for_status()
5960 content = response.content.strip()
6061 if response.encoding:
6162 content = content.decode(response.encoding)
62 response.raise_for_status()
6363 if content_type.split(';')[0] != 'application/json':
6464 return content
6565 if content.startswith(GERRIT_MAGIC_JSON_PREFIX):