mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
fix: unittest for python <3.6
This commit is contained in:
@@ -153,12 +153,6 @@ def __stringify_request(request_data):
|
||||
"""
|
||||
for key, value in request_data.items():
|
||||
|
||||
if key == "body":
|
||||
try:
|
||||
value = json.loads(value)
|
||||
except JSONDecodeError:
|
||||
pass
|
||||
|
||||
if isinstance(value, (list, dict)):
|
||||
value = dumps_json(value)
|
||||
|
||||
@@ -169,6 +163,13 @@ def __stringify_request(request_data):
|
||||
except UnicodeDecodeError:
|
||||
pass
|
||||
|
||||
if key == "body":
|
||||
try:
|
||||
# request body is in json format
|
||||
value = json.loads(value)
|
||||
except JSONDecodeError:
|
||||
pass
|
||||
|
||||
elif not isinstance(value, (basestring, numeric_types, Iterable)):
|
||||
# class instance, e.g. MultipartEncoder()
|
||||
value = repr(value)
|
||||
|
||||
Reference in New Issue
Block a user