fix(接口定义): 修复批量添加请求头未校验空值的缺陷

--bug=1016057 --user=王孝刚
接口测试/接口定义/编辑接口/TEST_在TEST页面的环境配置处点击批量添加,输入key点击确定按钮,弹框关闭后,请求头位置新增一栏,但显示key值为空
https://www.tapd.cn/55049933/s/1228341
This commit is contained in:
wxg0103 2022-08-19 19:52:05 +08:00 committed by f2c-ci-robot[bot]
parent 32e350521f
commit f31e835893
3 changed files with 27 additions and 16 deletions

View File

@ -148,7 +148,7 @@
<el-tooltip class="item-tabs" effect="dark" :content="$t('api_test.request.headers')" placement="top-start" <el-tooltip class="item-tabs" effect="dark" :content="$t('api_test.request.headers')" placement="top-start"
slot="label"> slot="label">
<span>{{ $t('api_test.request.headers') }} <span>{{ $t('api_test.request.headers') }}
<div class="el-step__icon is-text ms-api-col" v-if="headers.length>1"> <div class="el-step__icon is-text ms-api-col ms-header" v-if="headers.length>1">
<div class="el-step__icon-inner">{{ headers.length - 1 }}</div> <div class="el-step__icon-inner">{{ headers.length - 1 }}</div>
</div> </div>
</span> </span>
@ -655,4 +655,13 @@ fieldset {
display: none !important; display: none !important;
} }
.ms-header {
background: #783887;
color: white;
height: 18px;
font-size: xx-small;
border-radius: 50%;
}
</style> </style>

View File

@ -80,7 +80,7 @@
</el-tooltip> </el-tooltip>
<el-tooltip effect="dark" :content="$t('schema.adv_setting')" placement="top-start"> <el-tooltip effect="dark" :content="$t('schema.adv_setting')" placement="top-start">
<el-button icon="el-icon-setting" circle size="mini" style="margin-left: 10px" <el-button icon="el-icon-setting" circle size="mini" style="margin-left: 10px"
@click="openSetting(scope.row)" v-if="scope.row.type !=='LIST'"/> @click="openSetting(scope.row)" v-if="scope.row.type !=='LIST'" @change="change"/>
</el-tooltip> </el-tooltip>
</span> </span>

View File

@ -451,20 +451,22 @@ export default {
let params = data.split("\n"); let params = data.split("\n");
let keyValues = []; let keyValues = [];
params.forEach(item => { params.forEach(item => {
let line = item.split(/|:/); if (item) {
let values = item.split(line[0] + ":"); let line = item.split(/|:/);
let required = false; let values = item.split(line[0] + ":");
keyValues.push(new KeyValue({ let required = false;
name: line[0], keyValues.push(new KeyValue({
required: required, name: line[0],
value: values[1], required: required,
type: "text", value: values[1],
valid: false, type: "text",
file: false, valid: false,
encode: true, file: false,
enable: true, encode: true,
contentType: "text/plain" enable: true,
})); contentType: "text/plain"
}));
}
}); });
return keyValues; return keyValues;
}, },