raise exception
logger.debug("response.ok='%s',response.status_code=%d,response.reason='%s'", response.ok, response.status_code, response.reason)
- if not json_helper.is_json_response(response):
+ if not response.ok or response.status_code > 200:
+ json_reply["status_code"] = response.status_code
+ json_reply["error_message"] = f"response.ok='{response.ok}' or response.status_code={response.status_code} was not expected!"
+ logger.debug(json_reply["error_message"])
+ elif not json_helper.is_json_response(response):
+ logger.debug("content-type='%s' is not a valid JSON response!", response.headers.get("content-type"))
json_reply["status_code"] = 999
json_reply["error_message"] = f"content-type='{response.headers.get('content-type')}' is not a JSON response!"
elif response.ok and response.status_code == 200: