feat(接口测试): GET 请求支持 body

This commit is contained in:
chenjianxing 2020-09-17 21:45:31 +08:00
parent 98a46cc5f4
commit fbbd943990
3 changed files with 6 additions and 12 deletions

View File

@ -57,7 +57,7 @@
<el-tab-pane :label="$t('api_test.request.headers')" name="headers">
<ms-api-key-value :is-read-only="isReadOnly" :isShowEnable="true" :suggestions="headerSuggestions" :items="request.headers"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.request.body')" name="body" v-if="isNotGet">
<el-tab-pane :label="$t('api_test.request.body')" name="body">
<ms-api-body :is-read-only="isReadOnly"
:body="request.body"
:scenario="scenario"
@ -190,9 +190,6 @@ export default {
},
computed: {
isNotGet() {
return this.request.method !== "GET";
},
displayUrl() {
return (this.request.environment && this.request.environment.config.httpConfig.socket) ?
this.request.environment.config.httpConfig.protocol + '://' + this.request.environment.config.httpConfig.socket + (this.request.path ? this.request.path : '')

View File

@ -4,7 +4,7 @@
<el-button size="mini" @click="openController"
class="condition"
:class="controllerClass"
v-if="request.controller.isValid()">
v-if="request.controller && request.controller.isValid()">
<el-row type="flex" align="middle">
<font-awesome-icon :icon="['fas', 'random']"/>
<div class="condition-label">{{ request.controller.label() }}</div>
@ -16,10 +16,10 @@
<el-button size="mini" @click="openTimer"
class="condition"
:class="timerClass"
v-if="request.timer.isValid()">
v-if="request.timer && request.timer.isValid()">
<el-row type="flex" align="middle">
<font-awesome-icon :icon="['fas', 'clock']"/>
<div class="condition-label">{{ request.timer.label() }}</div>
<div class="condition-label">{{ request.timer && request.timer.label() }}</div>
</el-row>
</el-button>
</div>

View File

@ -1065,11 +1065,8 @@ class JMXGenerator {
} else if (request instanceof HttpRequest) {
sampler = new HTTPSamplerProxy(request.name || "", new JMXHttpRequest(request, scenario.environment));
this.addRequestHeader(sampler, request);
if (request.method.toUpperCase() === 'GET') {
this.addRequestArguments(sampler, request);
} else {
this.addRequestBody(sampler, request, testId);
}
this.addRequestArguments(sampler, request);
this.addRequestBody(sampler, request, testId);
} else if (request instanceof SqlRequest) {
request.dataSource = scenario.databaseConfigMap.get(request.dataSource);
sampler = new JDBCSampler(request.name || "", request);