mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 11:29:48 +08:00
change: update capture exception
This commit is contained in:
@@ -48,14 +48,14 @@ def get_req_resp_record(resp_obj: Response) -> ReqRespData:
|
||||
if request_body is not None:
|
||||
try:
|
||||
request_body = json.loads(request_body)
|
||||
except json.JSONDecodeError as ex:
|
||||
except json.JSONDecodeError:
|
||||
# str: a=1&b=2
|
||||
pass
|
||||
except UnicodeDecodeError as ex:
|
||||
# bytes/bytearray: request body in protobuf
|
||||
capture_exception(ex)
|
||||
except TypeError as ex:
|
||||
# neither str nor bytes/bytearray
|
||||
# neither str nor bytes/bytearray, e.g. <MultipartEncoder>
|
||||
capture_exception(ex)
|
||||
|
||||
request_content_type = lower_dict_keys(request_headers).get("content-type")
|
||||
|
||||
@@ -167,8 +167,8 @@ class HarParser(object):
|
||||
try:
|
||||
post_data = json.loads(post_data)
|
||||
request_data_key = "json"
|
||||
except JSONDecodeError as ex:
|
||||
capture_exception(ex)
|
||||
except JSONDecodeError:
|
||||
pass
|
||||
elif mimeType.startswith("application/x-www-form-urlencoded"):
|
||||
post_data = utils.convert_x_www_form_urlencoded_to_dict(post_data)
|
||||
else:
|
||||
@@ -238,16 +238,12 @@ class HarParser(object):
|
||||
|
||||
try:
|
||||
resp_content_json = json.loads(content)
|
||||
except JSONDecodeError as ex:
|
||||
capture_exception(ex)
|
||||
logger.warning(
|
||||
"response content can not be loaded as json: {}".format(
|
||||
content.encode("utf-8")
|
||||
)
|
||||
)
|
||||
except JSONDecodeError:
|
||||
logger.warning(f"response content can not be loaded as json: {content}")
|
||||
return
|
||||
|
||||
if not isinstance(resp_content_json, dict):
|
||||
# e.g. ['a', 'b']
|
||||
return
|
||||
|
||||
for key, value in resp_content_json.items():
|
||||
|
||||
Reference in New Issue
Block a user