Bläddra i källkod

fix: 修改接口测试返回结果为字符串时无法显示的问题

shanshan 4 år sedan
förälder
incheckning
d31341621a
1 ändrade filer med 6 tillägg och 2 borttagningar
  1. 6 2
      src/views/Project/InterfaceTest.vue

+ 6 - 2
src/views/Project/InterfaceTest.vue

@@ -723,10 +723,14 @@ export default {
           this.interfaceTestResults = await InterfaceTestAPI.getResults(id);
           this.interfaceTestAutoResults = await InterfaceTestAPI.getAutoResults(id);
           this.interfaceTestResults.forEach((item) => {
-            item.result = JSON.parse(item.result);
+            if (item.result.charAt(0) === '{') {
+              item.result = JSON.parse(item.result);
+            }
           });
           this.interfaceTestAutoResults.forEach((item) => {
-            item.result = JSON.parse(item.result);
+            if (item.result.charAt(0) === '{') {
+              item.result = JSON.parse(item.result);
+            }
           });
           this.detailDrawer = true;
           break;