From 46737136d976365be0baa7014d9fd6aa3b5fd45f Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 26 Jan 2021 11:40:44 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E4=BF=AE=E5=A4=8DDELETE=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E4=B8=A2=E5=A4=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../definition/request/sampler/MsHTTPSamplerProxy.java | 10 +++++++++- .../api/definition/components/case/ApiCaseHeader.vue | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) 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 6611ae1462..36b4c9c8ab 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 @@ -18,6 +18,7 @@ import org.apache.jmeter.protocol.http.control.Header; import org.apache.jmeter.protocol.http.control.HeaderManager; import org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy; import org.apache.jmeter.protocol.http.util.HTTPArgument; +import org.apache.jmeter.protocol.http.util.HTTPConstants; import org.apache.jmeter.save.SaveService; import org.apache.jmeter.testelement.TestElement; import org.apache.jorphan.collections.HashTree; @@ -152,7 +153,14 @@ public class MsHTTPSamplerProxy extends MsTestElement { sampler.setPath(envPath); } if (CollectionUtils.isNotEmpty(this.getArguments())) { - sampler.setPath(getPostQueryParameters(URLDecoder.decode(envPath, "UTF-8"))); + String path = getPostQueryParameters(URLDecoder.decode(envPath, "UTF-8")); + if (HTTPConstants.DELETE.equals(this.getMethod())) { + if (!path.startsWith("/")) { + path = "/" + path; + } + path = sampler.getProtocol() + "://" + sampler.getDomain() + ":" + sampler.getPort() + path; + } + sampler.setPath(path); } } else { String url = this.getUrl(); diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseHeader.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseHeader.vue index 49c9f097ac..03a44c66da 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseHeader.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseHeader.vue @@ -51,7 +51,7 @@ - +{{$t('api_test.definition.request.case')}} + +{{$t('api_test.definition.request.case')}}