refactor(接口测试): 优化仅支持导出HTTP协议接口

This commit is contained in:
WangXu10 2024-07-16 10:16:29 +08:00 committed by 刘瑞斌
parent cc414e64dc
commit 59c2aae047
3 changed files with 4 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import io.metersphere.api.mapper.ExtApiDefinitionMapper;
import io.metersphere.api.parser.api.Swagger3ExportParser; import io.metersphere.api.parser.api.Swagger3ExportParser;
import io.metersphere.project.domain.Project; import io.metersphere.project.domain.Project;
import io.metersphere.project.mapper.ProjectMapper; import io.metersphere.project.mapper.ProjectMapper;
import io.metersphere.sdk.constants.ModuleConstants;
import io.metersphere.sdk.exception.MSException; import io.metersphere.sdk.exception.MSException;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
@ -36,6 +37,7 @@ public class ApiDefinitionExportService {
private ProjectMapper projectMapper; private ProjectMapper projectMapper;
public ApiExportResponse export(ApiDefinitionBatchRequest request, String type, String userId) { public ApiExportResponse export(ApiDefinitionBatchRequest request, String type, String userId) {
request.setProtocols(List.of(ModuleConstants.NODE_PROTOCOL_HTTP));
List<String> ids = apiDefinitionService.getBatchApiIds(request, request.getProjectId(), request.getProtocols(), false, userId); List<String> ids = apiDefinitionService.getBatchApiIds(request, request.getProjectId(), request.getProtocols(), false, userId);
if (CollectionUtils.isEmpty(ids)) { if (CollectionUtils.isEmpty(ids)) {
return new ApiExportResponse(); return new ApiExportResponse();

View File

@ -80,7 +80,7 @@ export default {
'apiTestManagement.moreSetting': 'More Settings', 'apiTestManagement.moreSetting': 'More Settings',
'apiTestManagement.importType': 'Import Type', 'apiTestManagement.importType': 'Import Type',
'apiTestManagement.urlImport': 'URL Import', 'apiTestManagement.urlImport': 'URL Import',
'apiTestManagement.swagger.export': 'Export Swagger3.0', 'apiTestManagement.swagger.export': 'Export Swagger3.0(Only supports HTTP protocol)',
'apiTestManagement.syncImportCase': 'Sync Import API Cases', 'apiTestManagement.syncImportCase': 'Sync Import API Cases',
'apiTestManagement.syncUpdateDirectory': 'Sync Update API Directory', 'apiTestManagement.syncUpdateDirectory': 'Sync Update API Directory',
'apiTestManagement.importSwaggerFileTip1': 'Supports Swagger 3.0 version JSON files,', 'apiTestManagement.importSwaggerFileTip1': 'Supports Swagger 3.0 version JSON files,',

View File

@ -75,7 +75,7 @@ export default {
'apiTestManagement.moreSetting': '更多设置', 'apiTestManagement.moreSetting': '更多设置',
'apiTestManagement.importType': '导入方式', 'apiTestManagement.importType': '导入方式',
'apiTestManagement.urlImport': 'URL 导入', 'apiTestManagement.urlImport': 'URL 导入',
'apiTestManagement.swagger.export': '导出 Swagger3.0 格式', 'apiTestManagement.swagger.export': '导出 Swagger3.0 格式(仅支持HTTP协议)',
'apiTestManagement.syncImportCase': '同步导入接口用例', 'apiTestManagement.syncImportCase': '同步导入接口用例',
'apiTestManagement.syncUpdateDirectory': '同步更新接口所在目录', 'apiTestManagement.syncUpdateDirectory': '同步更新接口所在目录',
'apiTestManagement.importSwaggerFileTip1': '支持 Swagger 3.0 版本的 json 文件,', 'apiTestManagement.importSwaggerFileTip1': '支持 Swagger 3.0 版本的 json 文件,',