mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 11:29:48 +08:00
fix: compatibility when request body is None
This commit is contained in:
@@ -45,7 +45,14 @@ def get_req_resp_record(resp_obj: Response) -> ReqRespData:
|
||||
request_body = resp_obj.request.body
|
||||
try:
|
||||
request_body = json.loads(request_body)
|
||||
except (json.JSONDecodeError, UnicodeDecodeError):
|
||||
except json.JSONDecodeError:
|
||||
# str: Unexpected UTF-8 BOM (decode using utf-8-sig)
|
||||
pass
|
||||
except UnicodeDecodeError:
|
||||
# bytes/bytearray: request body in protobuf
|
||||
pass
|
||||
except TypeError:
|
||||
# neither str nor bytes/bytearray, e.g. None
|
||||
pass
|
||||
|
||||
if request_body:
|
||||
|
||||
Reference in New Issue
Block a user