diff --git a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java index b3ef8569d5..3d4a636615 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -100,6 +100,8 @@ public class ApiTestCaseService { private ApiTestCaseFollowMapper apiTestCaseFollowMapper; @Resource private ExtProjectVersionMapper extProjectVersionMapper; + @Resource + private TcpApiParamService tcpApiParamService; private static final String BODY_FILE_DIR = FileUtils.BODY_FILE_DIR; @@ -350,7 +352,7 @@ public class ApiTestCaseService { private ApiTestCase updateTest(SaveApiTestCaseRequest request) { checkNameExist(request); - + request.setRequest(tcpApiParamService.parseMsTestElement(request.getRequest())); if (StringUtils.isNotEmpty(request.getEsbDataStruct())) { request = esbApiParamService.handleEsbRequest(request); } diff --git a/backend/src/main/java/io/metersphere/api/service/TcpApiParamService.java b/backend/src/main/java/io/metersphere/api/service/TcpApiParamService.java index 70f17a0ab8..299215dd04 100644 --- a/backend/src/main/java/io/metersphere/api/service/TcpApiParamService.java +++ b/backend/src/main/java/io/metersphere/api/service/TcpApiParamService.java @@ -30,6 +30,22 @@ public class TcpApiParamService { return request; } + public MsTestElement parseMsTestElement(MsTestElement testElement) { + if (testElement == null) { + return null; + } + if (testElement instanceof MsTCPSampler) { + MsTCPSampler tcpSampler = this.handleTcpRequest(testElement); + if (tcpSampler != null) { + return tcpSampler; + } else { + return testElement; + } + } else { + return testElement; + } + } + public MsTCPSampler handleTcpRequest(MsTestElement testElement) { MsTCPSampler tcpSampler = null; try {