From 1811af7e6e7bd7c3b579b7e3d4cbef387467c122 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Wed, 19 Oct 2022 16:37:06 +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=9B=B4=E6=96=B0=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E7=A9=BA=E7=99=BDheader=E5=AD=98=E5=9C=A8=E7=9A=84=E7=BC=BA?= =?UTF-8?q?=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1018152 --user=王孝刚 【接口测试】更新接口,日志里报错 https://www.tapd.cn/55049933/s/1267889 --- .../business/definition/components/list/ApiList.vue | 13 +------------ .../io/metersphere/log/utils/ReflexObjectUtil.java | 4 +++- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/api-test/frontend/src/business/definition/components/list/ApiList.vue b/api-test/frontend/src/business/definition/components/list/ApiList.vue index ee5d7110ab..aa77dead91 100644 --- a/api-test/frontend/src/business/definition/components/list/ApiList.vue +++ b/api-test/frontend/src/business/definition/components/list/ApiList.vue @@ -273,7 +273,7 @@ import { initCondition } from "metersphere-frontend/src/utils/tableUtils"; import HeaderLabelOperate from "metersphere-frontend/src/components/head/HeaderLabelOperate"; -import {Body, KeyValue} from "@/business/definition/model/ApiTestModel"; +import {Body} from "@/business/definition/model/ApiTestModel"; import {getGraphByCondition} from "@/api/graph"; import ListItemDeleteConfirm from "metersphere-frontend/src/components/ListItemDeleteConfirm"; import MsSearch from "metersphere-frontend/src/components/search/MsSearch"; @@ -718,11 +718,6 @@ export default { } if (!item.request.headers) { item.request.headers = []; - } else if (item.request.headers.length === 1) { - let values = item.request.headers.filter(tab => tab.name !== ''); - if (values.length > 0) { - item.request.headers.push(new KeyValue({enable: true})) - } } if (!item.request.body.kvs) { item.request.body.kvs = []; @@ -736,12 +731,6 @@ export default { if (!item.request.rest) { item.request.rest = []; } - if (item.request.query && item.request.query.length === 1) { - let values = item.request.query.filter(tab => tab.name !== ''); - if (values.length > 0) { - item.request.query.push(new KeyValue({enable: true})) - } - } if (!item.request.arguments) { item.request.arguments = [{ contentType: "text/plain", diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/log/utils/ReflexObjectUtil.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/log/utils/ReflexObjectUtil.java index 677014c9c9..9e31c2ba0a 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/log/utils/ReflexObjectUtil.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/log/utils/ReflexObjectUtil.java @@ -177,7 +177,9 @@ public class ReflexObjectUtil { oldTags = StringUtils.join(StringUtils.join(JSON_START, ((originalColumns.get(i) != null && originalObject != null) ? originalObject.toString() : "\"\"")), JSON_END); } List newValueArray = JSON.parseArray(newValue.toString(), String.class); - Collections.sort(newValueArray); + if (CollectionUtils.isNotEmpty(newValueArray)) { + Collections.sort(newValueArray); + } Object newObject = JSON.toJSONString(newValueArray); String newTags = StringUtils.join(StringUtils.join(JSON_START, ((newColumns.get(i) != null && newObject != null) ? newObject.toString() : "\"\"")), JSON_END); String diffValue;