fix(接口测试): 修复历史数据导致请求路径错误问题
Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
parent
7ab9c9d628
commit
4befeadbcf
|
@ -36,6 +36,7 @@ import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.jmeter.config.Arguments;
|
import org.apache.jmeter.config.Arguments;
|
||||||
|
@ -114,6 +115,11 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
}
|
}
|
||||||
hashTree = this.getHashTree();
|
hashTree = this.getHashTree();
|
||||||
}
|
}
|
||||||
|
if (StringUtils.equalsAnyIgnoreCase(this.getReferenced(),
|
||||||
|
MsTestElementConstants.REF.name(), MsTestElementConstants.COPY.name())
|
||||||
|
|| BooleanUtils.isTrue(this.isRefEnvironment)) {
|
||||||
|
this.setUrl(null);
|
||||||
|
}
|
||||||
HTTPSamplerProxy sampler = new HTTPSamplerProxy();
|
HTTPSamplerProxy sampler = new HTTPSamplerProxy();
|
||||||
sampler.setEnabled(this.isEnable());
|
sampler.setEnabled(this.isEnable());
|
||||||
sampler.setName(this.getName());
|
sampler.setName(this.getName());
|
||||||
|
@ -397,8 +403,9 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
sampler.setProperty(HTTPSamplerBase.PATH, path);
|
sampler.setProperty(HTTPSamplerBase.PATH, path);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String envPath;
|
String envPath = this.path;
|
||||||
try {
|
try {
|
||||||
|
if (StringUtils.isNotBlank(url)) {
|
||||||
URL urlObject = new URL(url);
|
URL urlObject = new URL(url);
|
||||||
if (url.contains("${")) {
|
if (url.contains("${")) {
|
||||||
envPath = url;
|
envPath = url;
|
||||||
|
@ -408,6 +415,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
sampler.setPort(urlObject.getPort());
|
sampler.setPort(urlObject.getPort());
|
||||||
}
|
}
|
||||||
sampler.setProtocol(urlObject.getProtocol());
|
sampler.setProtocol(urlObject.getProtocol());
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
envPath = url == null ? "" : url;
|
envPath = url == null ? "" : url;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package io.metersphere.commons.constants;
|
package io.metersphere.commons.constants;
|
||||||
|
|
||||||
public enum MsTestElementConstants {
|
public enum MsTestElementConstants {
|
||||||
LoopController, SCENARIO, REF, Deleted, TransactionController
|
LoopController, SCENARIO, REF, COPY, Deleted, TransactionController
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue