fix(场景自动化): 修复认证问题
This commit is contained in:
parent
35336b58b6
commit
cd33380763
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.annotation.JSONField;
|
|||
import com.alibaba.fastjson.annotation.JSONType;
|
||||
import io.metersphere.api.dto.definition.request.MsTestElement;
|
||||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||
import io.metersphere.api.dto.definition.request.auth.MsAuthManager;
|
||||
import io.metersphere.api.dto.definition.request.dns.MsDNSCacheManager;
|
||||
import io.metersphere.api.dto.scenario.Body;
|
||||
import io.metersphere.api.dto.scenario.KeyValue;
|
||||
|
@ -87,6 +88,9 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
@JSONField(ordinal = 35)
|
||||
private Object requestResult;
|
||||
|
||||
@JSONField(ordinal = 36)
|
||||
private MsAuthManager authManager;
|
||||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (!this.isEnable()) {
|
||||
|
@ -223,6 +227,9 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
el.toHashTree(httpSamplerTree, el.getHashTree(), config);
|
||||
}
|
||||
}
|
||||
if (this.authManager != null) {
|
||||
this.authManager.toHashTree(tree, hashTree, config);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isVariable(String path, String value) {
|
||||
|
|
|
@ -107,6 +107,15 @@
|
|||
this.request.url = undefined;
|
||||
}
|
||||
}
|
||||
// 历史数据 auth 处理
|
||||
if (this.request.hashTree) {
|
||||
for (let index in this.request.hashTree) {
|
||||
if (this.request.hashTree[index].type == 'AuthManager') {
|
||||
this.request.authManager = this.request.hashTree[index];
|
||||
this.request.hashTree.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
|
@ -70,6 +70,8 @@
|
|||
case ELEMENT_TYPE.scenario:
|
||||
name = "MsApiScenarioComponent";
|
||||
break;
|
||||
case "AuthManager":
|
||||
break;
|
||||
default:
|
||||
name = "MsApiComponent";
|
||||
break;
|
||||
|
@ -107,7 +109,7 @@
|
|||
suggestClick(node) {
|
||||
this.$emit('suggestClick', node);
|
||||
},
|
||||
refReload(){
|
||||
refReload() {
|
||||
this.$emit('refReload');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<!-- 认证-->
|
||||
<el-tab-pane :label="$t('api_test.definition.request.verified')" name="verified">
|
||||
|
||||
<el-form :model="authConfig" size="small" :rules="rule" ref="authConfig">
|
||||
<el-form :model="authConfig" :rules="rule" ref="authConfig" label-position="right" label-width="80px">
|
||||
<el-form-item :label="$t('api_test.definition.request.verification_method')" prop="verification">
|
||||
<el-select v-model="authConfig.verification" @change="change"
|
||||
:placeholder="$t('api_test.definition.request.verification_method')" filterable size="small">
|
||||
|
@ -50,9 +50,7 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
</el-tab-pane>
|
||||
|
||||
</el-tabs>
|
||||
</template>
|
||||
|
||||
|
@ -66,11 +64,17 @@
|
|||
request: {},
|
||||
},
|
||||
created() {
|
||||
for (let index in this.request.hashTree) {
|
||||
if (this.request.hashTree[index].type == 'AuthManager') {
|
||||
this.authConfig = this.request.hashTree[index];
|
||||
if (this.request.hashTree) {
|
||||
for (let index in this.request.hashTree) {
|
||||
if (this.request.hashTree[index].type == 'AuthManager') {
|
||||
this.request.authManager = this.request.hashTree[index];
|
||||
this.request.hashTree.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.request.authManager) {
|
||||
this.authConfig = this.request.authManager;
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue