diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java index 71b89d5c68..3e81787c03 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java @@ -1044,7 +1044,7 @@ public class ApiTestCaseService extends MoveNodeService { AbstractMsTestElement apiMsTestElement = getApiMsTestElement(apiDefinitionBlob); ApiTestCaseBlob apiTestCaseBlob = apiTestCaseBlobMapper.selectByPrimaryKey(apiTestCase.getId()); AbstractMsTestElement apiTestCaseMsTestElement = getTestElement(apiTestCaseBlob); - boolean requestParamDifferent = HttpRequestParamDiffUtils.isRequestParamDiff(request.getSyncItems(), apiMsTestElement, apiTestCaseMsTestElement); + boolean requestParamDifferent = HttpRequestParamDiffUtils.isRequestParamDiff(apiMsTestElement, apiTestCaseMsTestElement); if (requestParamDifferent) { // 如果参数与定义不一致,则同步参数,并记录日志和发送通知 ApiTestCaseLogDTO originCase = BeanUtils.copyBean(new ApiTestCaseLogDTO(), apiTestCase); diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/utils/HttpRequestParamDiffUtils.java b/backend/services/api-test/src/main/java/io/metersphere/api/utils/HttpRequestParamDiffUtils.java index 281b6681ed..13094dde2d 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/utils/HttpRequestParamDiffUtils.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/utils/HttpRequestParamDiffUtils.java @@ -33,10 +33,6 @@ import static io.metersphere.sdk.util.XMLUtils.elementToMap; public class HttpRequestParamDiffUtils { public static boolean isRequestParamDiff(Object request1, Object request2) { - return isRequestParamDiff(new ApiCaseSyncItemRequest(), request1, request2); - } - - public static boolean isRequestParamDiff(ApiCaseSyncItemRequest syncItemRequest, Object request1, Object request2) { if (!(request1 instanceof MsHTTPElement)) { // 其他协议不比较 return false; @@ -48,12 +44,6 @@ public class HttpRequestParamDiffUtils { boolean isHeaderDiff = isParamKeyDiff(httpElement1.getHeaders(), httpElement2.getHeaders()); boolean isBodyDiff = isBodyDiff(httpElement1.getBody(), httpElement2.getBody()); - // 设置需要同步的同步项, 减少比较次数 - syncItemRequest.setBody(isBodyDiff && BooleanUtils.isTrue(syncItemRequest.getBody())); - syncItemRequest.setHeader(isHeaderDiff && BooleanUtils.isTrue(syncItemRequest.getHeader())); - syncItemRequest.setQuery(isQueryDiff && BooleanUtils.isTrue(syncItemRequest.getQuery())); - syncItemRequest.setRest(isRestDiff && BooleanUtils.isTrue(syncItemRequest.getRest())); - if (isQueryDiff || isRestDiff || isHeaderDiff || isBodyDiff) { return true; }