diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java
index 8f6e55789f..a69480193e 100644
--- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java
+++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java
@@ -227,7 +227,7 @@ public class MsTCPSampler extends MsTestElement {
}
private void parseEnvironment(EnvironmentConfig config) {
- if (!isCustomizeReq() && config != null) {
+ if (!isCustomizeReq() && config != null && config.getTcpConfig() != null) {
if (!isCustomizeReq() && config != null) {
this.server = config.getTcpConfig().getServer();
this.port = config.getTcpConfig().getPort();
@@ -238,6 +238,14 @@ public class MsTCPSampler extends MsTestElement {
this.eolByte = config.getTcpConfig().getEolByte();
}
}
+
+ if ((StringUtils.isEmpty(this.timeout) || StringUtils.equals(this.timeout, "0")) && StringUtils.isNotEmpty(config.getTcpConfig().getTimeout())) {
+ this.timeout = config.getTcpConfig().getTimeout();
+ }
+
+ if (StringUtils.isEmpty(this.ctimeout) || StringUtils.equals(this.ctimeout, "0") && StringUtils.isNotEmpty(config.getTcpConfig().getCtimeout())) {
+ this.ctimeout = config.getTcpConfig().getCtimeout();
+ }
}
}
}
@@ -265,6 +273,12 @@ public class MsTCPSampler extends MsTestElement {
tcpSampler.setCloseConnection(String.valueOf(this.isCloseConnection()));
tcpSampler.setSoLinger(this.getSoLinger());
tcpSampler.setEolByte(this.getEolByte());
+ if (StringUtils.isNotEmpty(this.timeout)) {
+ tcpSampler.setTimeout(this.timeout);
+ }
+ if (StringUtils.isNotEmpty(this.ctimeout)) {
+ tcpSampler.setConnectTimeout(this.ctimeout);
+ }
String value = this.getRequest();
if (StringUtils.isNotEmpty(this.getConnectEncoding())) {
diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue
index cd28a9c08a..e3bc48e160 100644
--- a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue
+++ b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue
@@ -111,7 +111,7 @@
{{ $t('api_test.definition.request.req_param') }}