我在post请求的data中有参数的值是中文,在用例运行的时候有报错,备注的内容是乱码,
查找资料,发现修改一个文件源码即可解决

在unic.py里面的43行能看到 def unic(item):

在红色划线框里面加上下面的这几行代码,再次运行的时候,用例执行成功
if isinstance(item, (list, dict, tuple)):
try:
item = json.dumps(item, ensure_ascii=False, encoding='utf-8')
except UnicodeDecodeError:
try:
item = json.dumps(item, ensure_ascii=False, encoding='utf-8')
except:
pass
except:
pass
代码位置放置如下

用例执行成功,数据被成功的加入到数据库中

网友评论