diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java b/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java index 1079616365..2b0da965de 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java @@ -97,9 +97,9 @@ public class ApiDefinitionController { @PostMapping(value = "/create", consumes = {"multipart/form-data"}) @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ_CREATE_API) @MsAuditLog(module = "api_definition", type = OperLogConstants.CREATE, title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = ApiDefinitionService.class) - public void create(@RequestPart("request") SaveApiDefinitionRequest request, @RequestPart(value = "files") List bodyFiles) { + public ApiDefinitionWithBLOBs create(@RequestPart("request") SaveApiDefinitionRequest request, @RequestPart(value = "files") List bodyFiles) { checkPermissionService.checkProjectOwner(request.getProjectId()); - apiDefinitionService.create(request, bodyFiles); + return apiDefinitionService.create(request, bodyFiles); } @PostMapping(value = "/update", consumes = {"multipart/form-data"}) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index 5707d093cc..6446f5d240 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -181,12 +181,13 @@ public class ApiDefinitionService { } } - public void create(SaveApiDefinitionRequest request, List bodyFiles) { + public ApiDefinitionWithBLOBs create(SaveApiDefinitionRequest request, List bodyFiles) { if (StringUtils.equals(request.getProtocol(), "DUBBO")) { request.setMethod("dubbo://"); } - createTest(request); + ApiDefinitionWithBLOBs returnModel = createTest(request); FileUtils.createBodyFiles(request.getRequest().getId(), bodyFiles); + return returnModel; } public ApiDefinitionWithBLOBs update(SaveApiDefinitionRequest request, List bodyFiles) { @@ -315,7 +316,7 @@ public class ApiDefinitionService { return test; } - private ApiDefinition createTest(SaveApiDefinitionRequest request) { + private ApiDefinitionWithBLOBs createTest(SaveApiDefinitionRequest request) { checkNameExist(request); if (StringUtils.equals(request.getMethod(), "ESB")) { //ESB的接口类型数据,采用TCP方式去发送。并将方法类型改为TCP。 并修改发送数据