Browse Source

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

shanshan 3 năm trước cách đây
mục cha
commit
d31341621a
1 tập tin đã thay đổi với 6 bổ sung2 xóa
  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;