fix: 修复接口定义新建接口时直接点击测试按钮出现报错的问题

修复接口定义新建接口时直接点击测试按钮出现报错的问题
This commit is contained in:
song-tianyang 2021-05-26 18:45:27 +08:00 committed by fit2-zhao
parent e074c50ba9
commit 0261109580
2 changed files with 6 additions and 5 deletions

View File

@ -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<MultipartFile> bodyFiles) {
public ApiDefinitionWithBLOBs create(@RequestPart("request") SaveApiDefinitionRequest request, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
checkPermissionService.checkProjectOwner(request.getProjectId());
apiDefinitionService.create(request, bodyFiles);
return apiDefinitionService.create(request, bodyFiles);
}
@PostMapping(value = "/update", consumes = {"multipart/form-data"})

View File

@ -181,12 +181,13 @@ public class ApiDefinitionService {
}
}
public void create(SaveApiDefinitionRequest request, List<MultipartFile> bodyFiles) {
public ApiDefinitionWithBLOBs create(SaveApiDefinitionRequest request, List<MultipartFile> 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<MultipartFile> 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 并修改发送数据