mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-28 19:47:14 +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
|
request_body = resp_obj.request.body
|
||||||
try:
|
try:
|
||||||
request_body = json.loads(request_body)
|
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
|
pass
|
||||||
|
|
||||||
if request_body:
|
if request_body:
|
||||||
|
|||||||
Reference in New Issue
Block a user