This commit is contained in:
chenjianxing 2020-06-03 16:00:09 +08:00
commit 1df3bb49c1
2 changed files with 12 additions and 10 deletions

View File

@ -2,14 +2,16 @@
<div>
<el-row :gutter="10" type="flex" justify="space-between" align="middle">
<el-col :span="10">
<ms-api-variable-input :is-read-only="isReadOnly" v-model="common.variable" size="small" maxlength="60" @change="change"
:placeholder="$t('api_test.variable_name')"/>
<ms-api-variable-input :is-read-only="isReadOnly" v-model="common.variable" size="small" maxlength="60"
@change="change" show-word-limit :placeholder="$t('api_test.variable_name')"/>
</el-col>
<el-col>
<el-input :disabled="isReadOnly" v-model="common.expression" maxlength="255" size="small" :placeholder="expression"/>
<el-input :disabled="isReadOnly" v-model="common.expression" maxlength="255" size="small" show-word-limit
:placeholder="expression"/>
</el-col>
<el-col class="extract-btn">
<el-button :disabled="isReadOnly" type="danger" size="mini" icon="el-icon-delete" circle @click="remove" v-if="edit"/>
<el-button :disabled="isReadOnly" type="danger" size="mini" icon="el-icon-delete" circle @click="remove"
v-if="edit"/>
<el-button :disabled="isReadOnly" type="primary" size="small" icon="el-icon-plus" plain @click="add" v-else/>
</el-col>
</el-row>

View File

@ -486,10 +486,10 @@ class JMXGenerator {
addRequestBody(httpSamplerProxy, request) {
let body = [];
if (request.body.isKV()) {
body = request.body.kvs.filter(this.filter);
body = this.replaceKV(request.body.kvs);
} else {
httpSamplerProxy.boolProp('HTTPSampler.postBodyRaw', true);
body.push({name: '', value: request.body.raw, encode: false});
body.push({name: '', value: this.replace(request.body.raw), encode: false});
}
httpSamplerProxy.add(new HTTPSamplerArguments(body));
@ -510,7 +510,7 @@ class JMXGenerator {
}
getAssertion(regex) {
let name = regex.description;
let name = this.replace(regex.description);
let type = JMX_ASSERTION_CONDITION.CONTAINS; // 固定用Match自己写正则
let value = this.replace(regex.expression);
switch (regex.subject) {
@ -546,8 +546,8 @@ class JMXGenerator {
getExtractor(extractCommon) {
let props = {
name: extractCommon.variable,
expression: extractCommon.expression,
name: this.replace(extractCommon.variable),
expression: this.replace(extractCommon.expression),
}
let testName = props.name
switch (extractCommon.type) {
@ -570,7 +570,7 @@ class JMXGenerator {
}
replace(str) {
if (!str) return str;
if (!str || !(typeof str === 'string')) return str;
return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/'/g, "&apos;").replace(/"/g, "&quot;");
}