From 8e4302303b4a123c8676e60cb232ba75903c28c1 Mon Sep 17 00:00:00 2001 From: MeterSphere Bot <78466014+metersphere-bot@users.noreply.github.com> Date: Mon, 22 Aug 2022 16:28:33 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8E=A8=E8=8D=90=E6=96=AD=E8=A8=80=E7=B2=BE?= =?UTF-8?q?=E5=BA=A6=E7=BC=BA=E5=A4=B1=E7=9A=84=E7=BC=BA=E9=99=B7=20(#1718?= =?UTF-8?q?9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1016060 --user=王孝刚 [接口测试]github#17107调用接口成功后,返回报文中某个返回值是100.00,推荐断言显示的是100,断言判断的是100.0 https://www.tapd.cn/55049933/s/1229064 Co-authored-by: wxg0103 <727495428@qq.com> --- .../api/definition/components/assertion/ApiJsonpathSuggest.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/business/components/api/definition/components/assertion/ApiJsonpathSuggest.vue b/frontend/src/business/components/api/definition/components/assertion/ApiJsonpathSuggest.vue index 2c42001ff0..9a103d9e57 100644 --- a/frontend/src/business/components/api/definition/components/assertion/ApiJsonpathSuggest.vue +++ b/frontend/src/business/components/api/definition/components/assertion/ApiJsonpathSuggest.vue @@ -68,9 +68,10 @@ export default { open(objStr) { this.data = {}; try { + let stringedJSON = objStr.replace(/:\s*([-+Ee0-9.]+)/g, ': "$1"'); // 解决精度丢失问题 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) { this.$warning('不支持解析JSON数组'); return;