fix(接口测试): 接口用例在请求内容选no auth 报错

【接口用例在请求内容选no auth报错】
https://www.tapd.cn/33805590/bugtrace/bugs/view?bug_id=1133805590001008973
This commit is contained in:
wxg0103 2021-12-20 14:06:19 +08:00 committed by shiziyuan9527
parent 16af01bfee
commit b2f307ce4a
1 changed files with 19 additions and 15 deletions

View File

@ -8,10 +8,10 @@
<el-select v-model="authConfig.verification" @change="change"
:placeholder="$t('api_test.definition.request.verification_method')" filterable size="small">
<el-option
v-for="item in options"
:key="item.name"
:label="item.name"
:value="item.name">
v-for="item in options"
:key="item.name"
:label="item.name"
:value="item.name">
</el-option>
</el-select>
@ -24,7 +24,8 @@
</el-input>
</el-form-item>
<el-form-item :label="$t('commons.password')" prop="password" v-if=" authConfig.verification!=undefined && authConfig.verification !='No Auth'">
<el-form-item :label="$t('commons.password')" prop="password"
v-if=" authConfig.verification!=undefined && authConfig.verification !='No Auth'">
<el-input v-model="authConfig.password" :placeholder="$t('commons.password')" show-password autocomplete="off"
maxlength="50" show-word-limit/>
</el-form-item>
@ -42,10 +43,10 @@
<el-select v-model="authConfig.encrypt"
:placeholder="$t('api_test.definition.request.verification_method')" filterable size="small">
<el-option
v-for="item in encryptOptions"
:key="item.id"
:label="item.name"
:value="item.id">
v-for="item in encryptOptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
@ -90,25 +91,28 @@ export default {
let authManager = createComponent("AuthManager");
authManager.verification = "Basic Auth";
authManager.environment = this.request.useEnvironment;
if(this.request.hashTree == undefined){
if (this.request.hashTree == undefined) {
this.request.hashTree = [];
}
this.request.hashTree.push(authManager);
//
if(this.authConfig.username == undefined && this.authConfig.password == undefined){
if (this.authConfig.username == undefined && this.authConfig.password == undefined) {
this.authConfig = authManager;
}
} else {
for (let index in this.request.hashTree) {
if (this.request.hashTree[index].type === "AuthManager") {
this.request.hashTree.splice(index, 1);
if (this.request.hashTree) {
for (let index in this.request.hashTree) {
if (this.request.hashTree[index].type === "AuthManager") {
this.request.hashTree.splice(index, 1);
}
}
}
this.request.authManager = {};
}
this.request.authManager = this.authConfig;
},
initData(){
initData() {
if (this.request.hashTree) {
for (let index in this.request.hashTree) {
if (this.request.hashTree[index].type == 'AuthManager') {