fix(接口定义): 修复无法使用jsonpath推荐断言的缺陷

--bug=1016162 --user=王孝刚
【接口测试】接口提取参数,执行ms登录接口,使用推荐jsonpath提取,提示响应结果不是json格式
https://www.tapd.cn/55049933/s/1231751
This commit is contained in:
wxg0103 2022-08-23 19:12:51 +08:00 committed by fit2-zhao
parent 87a5eef432
commit 89c64b8c02
1 changed files with 9 additions and 3 deletions

View File

@ -1,5 +1,6 @@
<template> <template>
<ms-drawer class="json-path-picker" :visible="visible" :size="30" @close="close" direction="right" v-clickoutside="close"> <ms-drawer class="json-path-picker" :visible="visible" :size="30" @close="close" direction="right"
v-clickoutside="close">
<template v-slot:header> <template v-slot:header>
<ms-instructions-icon :content="tip"/> <ms-instructions-icon :content="tip"/>
{{ tip }} {{ tip }}
@ -69,9 +70,14 @@ export default {
this.data = {}; this.data = {};
try { try {
let stringedJSON = objStr.replace(/:\s*([-+Ee0-9.]+)/g, ': "$1"'); let stringedJSON = objStr.replace(/:\s*([-+Ee0-9.]+)/g, ': "$1"');
// let param;
let JSONBig = require('json-bigint')({"storeAsString": true}); let JSONBig = require('json-bigint')({"storeAsString": true});
let param = JSON.parse(JSON.stringify(JSONBig.parse(stringedJSON))); //
try {
param = JSON.parse(JSON.stringify(JSONBig.parse(stringedJSON)));
} catch (e) {
param = JSON.parse(JSON.stringify(JSONBig.parse(objStr)));
}
if (param instanceof Array) { if (param instanceof Array) {
this.$warning('不支持解析JSON数组'); this.$warning('不支持解析JSON数组');
return; return;