From 0f0b11fd85a88e09da0eb179ea137ba001ad5bcf Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Mon, 23 Nov 2020 19:00:21 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):=20?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E5=8F=82=E6=95=B0=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../post/MsJSR223PostProcessor.java | 9 +- .../processors/pre/MsJSR223PreProcessor.java | 9 +- .../dto/definition/request/prop/BoolProp.java | 12 -- .../definition/request/prop/StringProp.java | 12 -- .../request/sampler/MsHTTPSamplerProxy.java | 36 +++--- .../api/definition/components/ApiConfig.vue | 2 +- .../api/definition/components/ApiList.vue | 2 +- .../api/definition/components/ApiModule.vue | 1 + .../components/basis/AddBasisHttpApi.vue | 2 +- .../complete/AddCompleteHttpApi.vue | 4 +- .../components/debug/DebugHttpPage.vue | 2 +- .../configurations/arguments/index.js | 31 ----- .../configurations/header-manager/index.js | 27 ----- .../jsr223-post-processor/index.js | 10 +- .../jsr223-pre-processor/index.js | 10 +- .../components/sampler/http-sampler/index.js | 110 +++--------------- .../components/processor/Jsr233Processor.vue | 4 +- .../components/runtest/RunTestHttpPage.vue | 4 +- 18 files changed, 62 insertions(+), 225 deletions(-) delete mode 100644 backend/src/main/java/io/metersphere/api/dto/definition/request/prop/BoolProp.java delete mode 100644 backend/src/main/java/io/metersphere/api/dto/definition/request/prop/StringProp.java diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJSR223PostProcessor.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJSR223PostProcessor.java index 83f715a96a..47321b3e6b 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJSR223PostProcessor.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/post/MsJSR223PostProcessor.java @@ -3,7 +3,6 @@ package io.metersphere.api.dto.definition.request.processors.post; 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.prop.StringProp; import lombok.Data; import lombok.EqualsAndHashCode; import org.apache.commons.collections.CollectionUtils; @@ -21,10 +20,10 @@ public class MsJSR223PostProcessor extends MsTestElement { private String type = "JSR223PostProcessor"; @JSONField(ordinal = 10) - private StringProp script; + private String script; @JSONField(ordinal = 11) - private StringProp scriptLanguage; + private String scriptLanguage; public void toHashTree(HashTree tree, List hashTree) { @@ -34,8 +33,8 @@ public class MsJSR223PostProcessor extends MsTestElement { processor.setProperty(TestElement.TEST_CLASS, JSR223PostProcessor.class.getName()); processor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI")); processor.setProperty("cacheKey", "true"); - processor.setProperty("scriptLanguage", this.getScriptLanguage().getValue()); - processor.setProperty("script", this.getScript().getValue()); + processor.setProperty("scriptLanguage", this.getScriptLanguage()); + processor.setProperty("script", this.getScript()); final HashTree jsr223PostTree = tree.add(processor); if (CollectionUtils.isNotEmpty(hashTree)) { diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJSR223PreProcessor.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJSR223PreProcessor.java index fab147f172..e6102392b6 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJSR223PreProcessor.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/processors/pre/MsJSR223PreProcessor.java @@ -3,7 +3,6 @@ package io.metersphere.api.dto.definition.request.processors.pre; 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.prop.StringProp; import lombok.Data; import lombok.EqualsAndHashCode; import org.apache.commons.collections.CollectionUtils; @@ -21,10 +20,10 @@ public class MsJSR223PreProcessor extends MsTestElement { private String type = "JSR223PreProcessor"; @JSONField(ordinal = 10) - private StringProp script; + private String script; @JSONField(ordinal = 11) - private StringProp scriptLanguage; + private String scriptLanguage; public void toHashTree(HashTree tree, List hashTree) { JSR223PreProcessor processor = new JSR223PreProcessor(); @@ -33,8 +32,8 @@ public class MsJSR223PreProcessor extends MsTestElement { processor.setProperty(TestElement.TEST_CLASS, JSR223PreProcessor.class.getName()); processor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI")); processor.setProperty("cacheKey", "true"); - processor.setProperty("scriptLanguage", this.getScriptLanguage().getValue()); - processor.setProperty("script", this.getScript().getValue()); + processor.setProperty("scriptLanguage", this.getScriptLanguage()); + processor.setProperty("script", this.getScript()); final HashTree jsr223PreTree = tree.add(processor); if (CollectionUtils.isNotEmpty(hashTree)) { diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/prop/BoolProp.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/prop/BoolProp.java deleted file mode 100644 index 9da886535d..0000000000 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/prop/BoolProp.java +++ /dev/null @@ -1,12 +0,0 @@ -package io.metersphere.api.dto.definition.request.prop; - -import lombok.Data; - -@Data -public class BoolProp { - private String id; - private String key; - private String name; - private String type; - private boolean value; -} diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/prop/StringProp.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/prop/StringProp.java deleted file mode 100644 index 4b565b8427..0000000000 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/prop/StringProp.java +++ /dev/null @@ -1,12 +0,0 @@ -package io.metersphere.api.dto.definition.request.prop; - -import lombok.Data; - -@Data -public class StringProp { - private String id; - private String key; - private String name; - private String type; - private String value; -} diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java index 7262c38393..99e90af344 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java @@ -6,8 +6,6 @@ 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.dns.MsDNSCacheManager; -import io.metersphere.api.dto.definition.request.prop.BoolProp; -import io.metersphere.api.dto.definition.request.prop.StringProp; import io.metersphere.api.dto.scenario.Body; import io.metersphere.api.dto.scenario.KeyValue; import io.metersphere.api.dto.scenario.environment.EnvironmentConfig; @@ -41,25 +39,25 @@ public class MsHTTPSamplerProxy extends MsTestElement { private String type = "HTTPSamplerProxy"; @JSONField(ordinal = 10) - private StringProp protocol; + private String protocol; @JSONField(ordinal = 11) - private StringProp domain; + private String domain; @JSONField(ordinal = 12) - private StringProp port; + private String port; @JSONField(ordinal = 13) - private StringProp method; + private String method; @JSONField(ordinal = 14) - private StringProp path; + private String path; @JSONField(ordinal = 15) - private StringProp connectTimeout; + private String connectTimeout; @JSONField(ordinal = 16) - private StringProp responseTimeout; + private String responseTimeout; @JSONField(ordinal = 17) private List arguments; @@ -74,10 +72,10 @@ public class MsHTTPSamplerProxy extends MsTestElement { private String url; @JSONField(ordinal = 21) - private BoolProp followRedirects; + private boolean followRedirects; @JSONField(ordinal = 22) - private BoolProp doMultipartPost; + private boolean doMultipartPost; @JSONField(ordinal = 23) private String useEnvironment; @@ -89,13 +87,13 @@ public class MsHTTPSamplerProxy extends MsTestElement { sampler.setName(this.getName()); sampler.setProperty(TestElement.TEST_CLASS, HTTPSamplerProxy.class.getName()); sampler.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("HttpTestSampleGui")); - sampler.setMethod(this.getMethod().getValue()); + sampler.setMethod(this.getMethod()); sampler.setContentEncoding("UTF-8"); - sampler.setConnectTimeout(this.getConnectTimeout().getValue() == null ? "6000" : this.getConnectTimeout().getValue()); - sampler.setResponseTimeout(this.getResponseTimeout().getValue() == null ? "6000" : this.getResponseTimeout().getValue()); - sampler.setFollowRedirects(this.getFollowRedirects() != null ? this.getFollowRedirects().isValue() : true); + sampler.setConnectTimeout(this.getConnectTimeout() == null ? "6000" : this.getConnectTimeout()); + sampler.setResponseTimeout(this.getResponseTimeout() == null ? "6000" : this.getResponseTimeout()); + sampler.setFollowRedirects(this.isFollowRedirects()); sampler.setUseKeepAlive(true); - sampler.setDoMultipart(this.getDoMultipartPost() != null ? this.getDoMultipartPost().isValue() : true); + sampler.setDoMultipart(this.isDoMultipartPost()); EnvironmentConfig config = null; if (useEnvironment != null) { ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class); @@ -111,8 +109,8 @@ public class MsHTTPSamplerProxy extends MsTestElement { url = config.getHttpConfig().getProtocol() + "://" + config.getHttpConfig().getSocket(); URL urlObject = new URL(url); String envPath = StringUtils.equals(urlObject.getPath(), "/") ? "" : urlObject.getPath(); - if (StringUtils.isNotBlank(this.getPath().getValue())) { - envPath += this.getPath().getValue(); + if (StringUtils.isNotBlank(this.getPath())) { + envPath += this.getPath(); } if (CollectionUtils.isNotEmpty(this.getRest()) && this.isRest()) { sampler.setPath(getRestParameters(URLDecoder.decode(envPath, "UTF-8"))); @@ -141,7 +139,7 @@ public class MsHTTPSamplerProxy extends MsTestElement { sampler.setArguments(httpArguments(this.getArguments())); } // 请求体 - if (!StringUtils.equals(this.getMethod().getValue(), "GET")) { + if (!StringUtils.equals(this.getMethod(), "GET")) { List body = new ArrayList<>(); if (this.getBody().isKV() || this.getBody().isBinary()) { body = this.getBody().getKvs().stream().filter(KeyValue::isValid).collect(Collectors.toList()); diff --git a/frontend/src/business/components/api/definition/components/ApiConfig.vue b/frontend/src/business/components/api/definition/components/ApiConfig.vue index 8f08e93c86..c80d5b3e30 100644 --- a/frontend/src/business/components/api/definition/components/ApiConfig.vue +++ b/frontend/src/business/components/api/definition/components/ApiConfig.vue @@ -56,7 +56,7 @@ } if (this.currentApi != null && this.currentApi.id != null) { this.reqUrl = "/api/definition/update"; - this.currentApi.url = this.request.path.value; + this.currentApi.url = this.request.path; } else { this.reqUrl = "/api/definition/create"; this.currentApi.id = getUUID().substring(0, 8); diff --git a/frontend/src/business/components/api/definition/components/ApiList.vue b/frontend/src/business/components/api/definition/components/ApiList.vue index a8920fa4a9..9bf2119de1 100644 --- a/frontend/src/business/components/api/definition/components/ApiList.vue +++ b/frontend/src/business/components/api/definition/components/ApiList.vue @@ -246,7 +246,7 @@ handleTestCase(testCase) { this.selectApi = testCase; let request = JSON.parse(testCase.request); - this.selectApi.url = request.path.value; + this.selectApi.url = request.path; this.isHide = false; }, handleDelete(testCase) { diff --git a/frontend/src/business/components/api/definition/components/ApiModule.vue b/frontend/src/business/components/api/definition/components/ApiModule.vue index 7c1d534f02..3e1d5cac64 100644 --- a/frontend/src/business/components/api/definition/components/ApiModule.vue +++ b/frontend/src/business/components/api/definition/components/ApiModule.vue @@ -156,6 +156,7 @@ getApiGroupData() { this.getProjects(); this.getApiModuleTree(); + this.changeProtocol(); }, findTreeByNodeId(rootNode, nodeId) { if (rootNode.id == nodeId) { diff --git a/frontend/src/business/components/api/definition/components/basis/AddBasisHttpApi.vue b/frontend/src/business/components/api/definition/components/basis/AddBasisHttpApi.vue index 09dd470666..7d21d6b7e3 100644 --- a/frontend/src/business/components/api/definition/components/basis/AddBasisHttpApi.vue +++ b/frontend/src/business/components/api/definition/components/basis/AddBasisHttpApi.vue @@ -100,7 +100,7 @@ this.httpForm.protocol = this.currentProtocol; let header = createComponent("HeaderManager"); let request = createComponent("HTTPSamplerProxy"); - request.path.value = this.httpForm.url; + request.path = this.httpForm.url; request.hashTree = [header]; this.httpForm.request = request; if (this.currentModule != null) { diff --git a/frontend/src/business/components/api/definition/components/complete/AddCompleteHttpApi.vue b/frontend/src/business/components/api/definition/components/complete/AddCompleteHttpApi.vue index f2da268d1c..9ab4f955f3 100644 --- a/frontend/src/business/components/api/definition/components/complete/AddCompleteHttpApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/AddCompleteHttpApi.vue @@ -24,7 +24,7 @@ - + @@ -127,7 +127,7 @@ }, setParameter() { this.httpForm.modulePath = this.getPath(this.httpForm.moduleId); - this.request.path.value = this.httpForm.url; + this.request.path = this.httpForm.url; this.httpForm.request.useEnvironment = undefined; }, saveApi() { diff --git a/frontend/src/business/components/api/definition/components/debug/DebugHttpPage.vue b/frontend/src/business/components/api/definition/components/debug/DebugHttpPage.vue index 0ecb77f044..2c1521431b 100644 --- a/frontend/src/business/components/api/definition/components/debug/DebugHttpPage.vue +++ b/frontend/src/business/components/api/definition/components/debug/DebugHttpPage.vue @@ -111,7 +111,7 @@ if (valid) { this.loading = true; this.request.url = this.debugForm.url; - this.request.method.value = this.debugForm.method; + this.request.method = this.debugForm.method; this.request.hashTree[0].headers = this.headers; this.request.name = getUUID().substring(0, 8); this.runData = []; diff --git a/frontend/src/business/components/api/definition/components/jmeter/components/configurations/arguments/index.js b/frontend/src/business/components/api/definition/components/jmeter/components/configurations/arguments/index.js index 8a6ad8dc77..47a4ea4379 100644 --- a/frontend/src/business/components/api/definition/components/jmeter/components/configurations/arguments/index.js +++ b/frontend/src/business/components/api/definition/components/jmeter/components/configurations/arguments/index.js @@ -1,4 +1,3 @@ -import {elementProp, stringProp} from "../../../props"; import Configuration from "../configuration"; const DEFAULT_OPTIONS = { @@ -17,36 +16,6 @@ export default class Arguments extends Configuration { super(options); this.arguments = []; - let collectionProp = this.initCollectionProp('Arguments.arguments'); - collectionProp.forEach(elementProp => { - let name = elementProp.initStringProp('Argument.name').value; - let value = elementProp.initStringProp('Argument.value').value; - let desc = elementProp.initStringProp('Argument.desc').value; - let metadata = elementProp.initStringProp('Argument.metadata', "=").value; - let argument = {name: name, value: value, desc: desc, metadata: metadata, enable: true}; - - this.arguments.push(argument); - }) - } - - updateProps() { - let collectionProp = this.props['Arguments.arguments']; - collectionProp.clear(); - this.arguments.forEach(arg => { - if (arg.enable !== false) { - let ep = elementProp(arg.name, "Argument"); - ep.add(stringProp("Argument.name", arg.name)); - ep.add(stringProp("Argument.value", arg.value)); - ep.add(stringProp("Argument.desc", arg.desc)); - ep.add(stringProp("Argument.metadata", arg.metadata || "=")); - collectionProp.add(ep) - } - }) - } - - toJson() { - this.updateProps(); - return super.toJson(); } } diff --git a/frontend/src/business/components/api/definition/components/jmeter/components/configurations/header-manager/index.js b/frontend/src/business/components/api/definition/components/jmeter/components/configurations/header-manager/index.js index 6a8d2a88d1..428e14a674 100644 --- a/frontend/src/business/components/api/definition/components/jmeter/components/configurations/header-manager/index.js +++ b/frontend/src/business/components/api/definition/components/jmeter/components/configurations/header-manager/index.js @@ -1,4 +1,3 @@ -import {elementProp, stringProp} from "../../../props"; import Configuration from "../configuration"; const DEFAULT_OPTIONS = { @@ -17,32 +16,6 @@ export default class HeaderManager extends Configuration { super(options); this.type = "HeaderManager"; this.headers = []; - let collectionProp = this.initCollectionProp('HeaderManager.headers'); - collectionProp.forEach(elementProp => { - let name = elementProp.initStringProp('Header.name').value; - let value = elementProp.initStringProp('Header.value').value; - let header = {name: name, value: value, enable: true}; - - this.headers.push(header); - }) - } - - updateProps() { - let collectionProp = this.props['HeaderManager.headers']; - collectionProp.clear(); - this.headers.forEach(header => { - if (header.enable !== false) { - let ep = elementProp("", "Header"); - ep.add(stringProp("Header.name", header.name)); - ep.add(stringProp("Header.value", header.value)); - collectionProp.add(ep) - } - }) - } - - toJson() { - this.updateProps(); - return super.toJson(); } } diff --git a/frontend/src/business/components/api/definition/components/jmeter/components/post-processors/jsr223-post-processor/index.js b/frontend/src/business/components/api/definition/components/jmeter/components/post-processors/jsr223-post-processor/index.js index 95a50dff25..a3525aaff6 100644 --- a/frontend/src/business/components/api/definition/components/jmeter/components/post-processors/jsr223-post-processor/index.js +++ b/frontend/src/business/components/api/definition/components/jmeter/components/post-processors/jsr223-post-processor/index.js @@ -15,11 +15,11 @@ export default class JSR223PostProcessor extends PostProcessor { constructor(options = DEFAULT_OPTIONS) { super(options); this.type = "JSR223PostProcessor"; - this.scriptLanguage = this.initStringProp("scriptLanguage", "java") - this.parameters = this.initStringProp("parameters") - this.filename = this.initStringProp("filename") - this.cacheKey = this.initStringProp("cacheKey", true) - this.script = this.initStringProp("script") + this.scriptLanguage = "java"; + this.parameters = []; + this.filename = undefined; + this.cacheKey = true; + this.script = undefined; } } diff --git a/frontend/src/business/components/api/definition/components/jmeter/components/pre-processors/jsr223-pre-processor/index.js b/frontend/src/business/components/api/definition/components/jmeter/components/pre-processors/jsr223-pre-processor/index.js index b249eecd44..f73b7ee69b 100644 --- a/frontend/src/business/components/api/definition/components/jmeter/components/pre-processors/jsr223-pre-processor/index.js +++ b/frontend/src/business/components/api/definition/components/jmeter/components/pre-processors/jsr223-pre-processor/index.js @@ -15,11 +15,11 @@ export default class JSR223PreProcessor extends PostProcessor { constructor(options = DEFAULT_OPTIONS) { super(options); this.type = "JSR223PreProcessor"; - this.scriptLanguage = this.initStringProp("scriptLanguage", "java") - this.parameters = this.initStringProp("parameters") - this.filename = this.initStringProp("filename") - this.cacheKey = this.initStringProp("cacheKey", true) - this.script = this.initStringProp("script") + this.scriptLanguage = "java"; + this.parameters = []; + this.filename = undefined; + this.cacheKey = undefined; + this.script = undefined; } } diff --git a/frontend/src/business/components/api/definition/components/jmeter/components/sampler/http-sampler/index.js b/frontend/src/business/components/api/definition/components/jmeter/components/sampler/http-sampler/index.js index b317ab95fb..63a357344b 100644 --- a/frontend/src/business/components/api/definition/components/jmeter/components/sampler/http-sampler/index.js +++ b/frontend/src/business/components/api/definition/components/jmeter/components/sampler/http-sampler/index.js @@ -1,6 +1,6 @@ -import {boolProp, elementProp, stringProp} from "../../../props"; import Sampler from "../sampler"; import {Body} from "../../../../../model/ApiTestModel"; + const DEFAULT_OPTIONS = { options: { attributes: { @@ -14,106 +14,28 @@ const DEFAULT_OPTIONS = { export default class HTTPSamplerProxy extends Sampler { constructor(options = DEFAULT_OPTIONS) { super(options); - this.protocol = this.initStringProp('HTTPSampler.protocol', "https"); - this.domain = this.initStringProp('HTTPSampler.domain'); - this.port = this.initStringProp('HTTPSampler.port'); this.type = "HTTPSamplerProxy"; - this.method = this.initStringProp('HTTPSampler.method', "GET"); - this.path = this.initStringProp('HTTPSampler.path'); - this.contentEncoding = this.initStringProp('HTTPSampler.contentEncoding', "UTF-8"); + this.protocol = "HTTP"; + this.domain = undefined; + this.port = undefined; + this.method = undefined; + this.path = undefined; + this.contentEncoding = undefined; - this.autoRedirects = this.initBoolProp('HTTPSampler.auto_redirects'); - this.followRedirects = this.initBoolProp('HTTPSampler.follow_redirects', true); - this.useKeepalive = this.initBoolProp('HTTPSampler.use_keepalive', true); - this.postBodyRaw = this.initBoolProp('HTTPSampler.postBodyRaw'); - this.doMultipartPost = this.initBoolProp('HTTPSampler.DO_MULTIPART_POST', false); - this.browserCompatibleMultipart = this.initBoolProp('HTTPSampler.BROWSER_COMPATIBLE_MULTIPART'); - this.embeddedUrlRe = this.initStringProp('HTTPSampler.embedded_url_re'); - this.connectTimeout = this.initStringProp('HTTPSampler.connect_timeout'); - this.responseTimeout = this.initStringProp('HTTPSampler.response_timeout'); + this.autoRedirects = false; + this.followRedirects = true; + this.useKeepalive = true; + this.postBodyRaw = undefined; + this.doMultipartPost = false; + this.browserCompatibleMultipart = undefined; + this.embeddedUrlRe = undefined; + this.connectTimeout = 6000; + this.responseTimeout = 6000; // 初始化主体对象 this.body = new Body(); - this.arguments = []; - this.rest = []; - - let elementProp = this.initElementProp('HTTPsampler.Arguments', 'Arguments'); - let collectionProp = elementProp.initCollectionProp('Arguments.arguments'); - - collectionProp.forEach(elementProp => { - let name = elementProp.initStringProp('Argument.name').value; - let value = elementProp.initStringProp('Argument.value').value; - - let alwaysEncode = elementProp.initBoolProp('HTTPArgument.always_encode').value; - let useEquals = elementProp.initBoolProp('HTTPArgument.use_equals', true).value; - let contentType = elementProp.initStringProp('HTTPArgument.content_type', "text/plain").value; - let arg = { - name: name, - value: value, - alwaysEncode: alwaysEncode, - useEquals: useEquals, - contentType: contentType, - enable: true - }; - - this.arguments.push(arg); - }) - - if (this.arguments.length > 0 && this.arguments[0].name === "") { - this.body = this.arguments[0].value; - } - this.files = []; - let filesProp = this.initElementProp("HTTPsampler.Files", "HTTPFileArgs"); - let filesCollectionProp = filesProp.initCollectionProp('HTTPFileArgs.files'); - filesCollectionProp.forEach(elementProp => { - let path = elementProp.initStringProp('File.path').value; - let name = elementProp.initStringProp('File.paramname').value; - let type = elementProp.initBoolProp('File.mimetype').value; - let file = {path: path, name: name, type: type, enable: true}; - - this.files.push(file); - }); - } - - updateProps() { - if (this.body && this.postBodyRaw.value) { - this.arguments = [{name: "", value: this.body, alwaysEncode: false}]; - } - let collectionProp = this.props['HTTPsampler.Arguments'].elements['Arguments.arguments']; - collectionProp.clear(); - this.arguments.forEach(variable => { - if (variable.enable !== false) { - let ep = elementProp(variable.name, "HTTPArgument"); - ep.add(stringProp("Argument.name", variable.name)); - ep.add(stringProp("Argument.value", variable.value)); - ep.add(stringProp("Argument.metadata", "=")); - ep.add(boolProp("HTTPArgument.always_encode", variable.alwaysEncode)); - ep.add(boolProp("HTTPArgument.use_equals", variable.useEquals)); - if (variable.contentType && variable.contentType !== "text/plain") { - ep.add(stringProp("HTTPArgument.content_type", variable.contentType)); - } - collectionProp.add(ep) - } - }) - - let filesProp = this.props["HTTPsampler.Files"].elements["HTTPFileArgs.files"]; - filesProp.clear(); - this.files.forEach(file => { - if (file.enable !== false) { - let ep = elementProp(file.path, "HTTPFileArg"); - ep.add(stringProp("File.path", file.path)); - ep.add(stringProp("File.paramname", file.name)); - ep.add(stringProp("File.mimetype", file.type)); - filesProp.add(ep); - } - }) - } - - toJson() { - this.updateProps(); - return super.toJson(); } } diff --git a/frontend/src/business/components/api/definition/components/processor/Jsr233Processor.vue b/frontend/src/business/components/api/definition/components/processor/Jsr233Processor.vue index 50b6088ae5..7129196843 100644 --- a/frontend/src/business/components/api/definition/components/processor/Jsr233Processor.vue +++ b/frontend/src/business/components/api/definition/components/processor/Jsr233Processor.vue @@ -22,9 +22,9 @@ - diff --git a/frontend/src/business/components/api/definition/components/runtest/RunTestHttpPage.vue b/frontend/src/business/components/api/definition/components/runtest/RunTestHttpPage.vue index 7641b8a115..99ca13380f 100644 --- a/frontend/src/business/components/api/definition/components/runtest/RunTestHttpPage.vue +++ b/frontend/src/business/components/api/definition/components/runtest/RunTestHttpPage.vue @@ -8,7 +8,7 @@

{{$t('test_track.plan_view.base_info')}}

- + @@ -36,7 +36,7 @@ -