fix: 完整自定义请求不拼接mock地址

This commit is contained in:
chenjianxing 2021-05-27 10:14:36 +08:00 committed by jianxing
parent f33ac1b43f
commit c39c59c3c5
2 changed files with 23 additions and 9 deletions

View File

@ -242,16 +242,18 @@ public class MsHTTPSamplerProxy extends MsTestElement {
}
} else {
if (!isCustomizeReq() || isRefEnvironment) {
//1.9 增加对Mock环境的判断
if (this.isMockEnvironment()) {
url = httpConfig.getProtocol() + "://" + httpConfig.getSocket() + "/mock/" + this.getProjectId();
} else {
if (httpConfig.isMock()) {
if (isNeedAddMockUrl(url)) {
//1.9 增加对Mock环境的判断
if (this.isMockEnvironment()) {
url = httpConfig.getProtocol() + "://" + httpConfig.getSocket() + "/mock/" + this.getProjectId();
} else {
url = httpConfig.getProtocol() + "://" + httpConfig.getSocket();
}
if (httpConfig.isMock()) {
url = httpConfig.getProtocol() + "://" + httpConfig.getSocket() + "/mock/" + this.getProjectId();
} else {
url = httpConfig.getProtocol() + "://" + httpConfig.getSocket();
}
}
}
URL urlObject = new URL(url);
String envPath = StringUtils.equals(urlObject.getPath(), "/") ? "" : urlObject.getPath();
@ -421,6 +423,18 @@ public class MsHTTPSamplerProxy extends MsTestElement {
}
/**
* 自定义请求如果是完整url时不拼接mock信息
* @param url
* @return
*/
private boolean isNeedAddMockUrl(String url) {
if (isCustomizeReq() && (url.startsWith("http://") || url.startsWith("https://"))) {
return false;
}
return true;
}
// 兼容旧数据
private void compatible(ParameterConfig config) {
if (this.isCustomizeReq() && this.isRefEnvironment == null) {

View File

@ -82,8 +82,8 @@ export default {
},
props: {
screenHeight: {
type: String,
default: '400',
type: Number,
default: 400,
},
selectNodeIds: {
type: Array,