From 3e8b906a4c5e211b7cd9e5b0085dcef5c953a427 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 28 May 2020 14:14:10 +0800 Subject: [PATCH] fix: UnicodeDecodeError when request body in protobuf --- docs/CHANGELOG.md | 1 + httprunner/client.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index caa293f7..cc7eabac 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -11,6 +11,7 @@ - fix: ensure converted python file in utf-8 encoding - fix: duplicate running referenced testcase - fix: ensure compatibility issues between testcase format v2 and v3 +- fix: UnicodeDecodeError when request body in protobuf ## 3.0.5 (2020-05-22) diff --git a/httprunner/client.py b/httprunner/client.py index f5474ce3..54f168e1 100644 --- a/httprunner/client.py +++ b/httprunner/client.py @@ -45,7 +45,7 @@ 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: + except (json.JSONDecodeError, UnicodeDecodeError): pass if request_body: