fix(接口定义): 修复更新接口,空白header存在的缺陷

--bug=1018152 --user=王孝刚 【接口测试】更新接口,日志里报错
https://www.tapd.cn/55049933/s/1267889
This commit is contained in:
wxg0103 2022-10-19 16:37:06 +08:00 committed by 刘瑞斌
parent 26b8c30e56
commit 1811af7e6e
2 changed files with 4 additions and 13 deletions

View File

@ -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",

View File

@ -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<String> 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;