fix(接口测试): QUERY参数修改时变更记录修改有误

--bug=1026740 --user=宋昌昌 【接口测试】接口导入后-删除query参数-变更记录显示未变更的参数 https://www.tapd.cn/55049933/s/1386695
This commit is contained in:
song-cc-rock 2023-06-27 10:25:46 +08:00 committed by 刘瑞斌
parent c32a767715
commit e4b868a93f
1 changed files with 23 additions and 0 deletions

View File

@ -359,6 +359,9 @@ export default {
}
this.sort(data.request.hashTree);
}
if (data.response) {
this.parseResponseStructureDefaultKeyValue(data.response);
}
updateDefinition(this.reqUrl, null, bodyFiles, data).then((response) => {
this.$success(this.$t('commons.save_success'));
this.reqUrl = '/api/definition/update';
@ -376,6 +379,26 @@ export default {
this.responseCount = 0;
this.count = 0;
},
parseResponseStructureDefaultKeyValue(response) {
if (response.headers && response.headers.length === 1) {
let kv = response.headers[0];
if (!kv.name || !kv.value) {
response.headers = [];
}
if ((kv.name == null || kv.name === '') && (kv.value == null || kv.value === '')) {
response.headers = [];
}
}
if (response.statusCode && response.statusCode.length === 1) {
let kv = response.statusCode[0];
if (!kv.name || !kv.value) {
response.statusCode = [];
}
if ((kv.name == null || kv.name === '') && (kv.value == null || kv.value === '')) {
response.statusCode = [];
}
}
},
handleSave() {
if (this.$refs.httpApi) {
this.$refs.httpApi.saveApi();