fix(接口定义): 修复推荐断言精度缺失的缺陷 (#17189)
--bug=1016060 --user=王孝刚 [接口测试]github#17107调用接口成功后,返回报文中某个返回值是100.00,推荐断言显示的是100,断言判断的是100.0 https://www.tapd.cn/55049933/s/1229064 Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
parent
82c4369f6d
commit
8e4302303b
|
@ -68,9 +68,10 @@ export default {
|
||||||
open(objStr) {
|
open(objStr) {
|
||||||
this.data = {};
|
this.data = {};
|
||||||
try {
|
try {
|
||||||
|
let stringedJSON = objStr.replace(/:\s*([-+Ee0-9.]+)/g, ': "$1"');
|
||||||
// 解决精度丢失问题
|
// 解决精度丢失问题
|
||||||
let JSONBig = require('json-bigint')({"storeAsString": true});
|
let JSONBig = require('json-bigint')({"storeAsString": true});
|
||||||
let param = JSON.parse(JSON.stringify(JSONBig.parse(objStr)));
|
let param = JSON.parse(JSON.stringify(JSONBig.parse(stringedJSON)));
|
||||||
if (param instanceof Array) {
|
if (param instanceof Array) {
|
||||||
this.$warning('不支持解析JSON数组');
|
this.$warning('不支持解析JSON数组');
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue