mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-04 21:19:52 +08:00
refactor(接口测试): 接口定义导入部分字段进行trim处理
This commit is contained in:
parent
d5c739a4da
commit
8d65802488
@ -77,12 +77,12 @@ public abstract class HttpApiDefinitionImportAbstractParser<T> implements ApiDef
|
||||
protected ApiDefinitionDetail buildApiDefinition(String name, String path, String method, String modulePath, ImportRequest importRequest) {
|
||||
ApiDefinitionDetail apiDefinition = new ApiDefinitionDetail();
|
||||
apiDefinition.setId(IDGenerator.nextStr());
|
||||
apiDefinition.setName(name);
|
||||
apiDefinition.setPath(formatPath(path));
|
||||
apiDefinition.setProtocol(importRequest.getProtocol());
|
||||
apiDefinition.setMethod(method);
|
||||
apiDefinition.setProjectId(importRequest.getProjectId());
|
||||
apiDefinition.setModulePath(modulePath);
|
||||
apiDefinition.setName(StringUtils.trim(name));
|
||||
apiDefinition.setPath(formatPath(StringUtils.trim(path)));
|
||||
apiDefinition.setProtocol(StringUtils.trim(importRequest.getProtocol()));
|
||||
apiDefinition.setMethod(StringUtils.trim(method));
|
||||
apiDefinition.setProjectId(StringUtils.trim(importRequest.getProjectId()));
|
||||
apiDefinition.setModulePath(StringUtils.trim(modulePath));
|
||||
apiDefinition.setResponse(new ArrayList<>());
|
||||
return apiDefinition;
|
||||
}
|
||||
|
@ -100,10 +100,10 @@ public class JmeterParserApiDefinition implements ApiDefinitionImportParser<ApiI
|
||||
|
||||
for (AbstractMsProtocolTestElement protocolTestElement : msElement) {
|
||||
ApiDefinitionDetail definition = new ApiDefinitionDetail();
|
||||
definition.setName(protocolTestElement.getName());
|
||||
definition.setName(StringUtils.trim(protocolTestElement.getName()));
|
||||
if (protocolTestElement instanceof MsHTTPElement msHTTPElement) {
|
||||
definition.setMethod(msHTTPElement.getMethod());
|
||||
definition.setPath(msHTTPElement.getPath());
|
||||
definition.setMethod(StringUtils.trim(msHTTPElement.getMethod()));
|
||||
definition.setPath(StringUtils.trim(msHTTPElement.getPath()));
|
||||
definition.setProtocol(ApiConstants.HTTP_PROTOCOL);
|
||||
} else {
|
||||
definition.setProtocol(polymorphicNameMap.get(protocolTestElement.getClass().getSimpleName()));
|
||||
|
@ -532,6 +532,10 @@ public class ApiDefinitionImportService {
|
||||
ApiDefinitionDetail importApi = existenceApiDefinitionDetail.getImportApiDefinition();
|
||||
ApiDefinitionDetail existenceApi = existenceApiDefinitionDetail.getExistenceApiDefinition();
|
||||
|
||||
if (StringUtils.isNotBlank(importApi.getModulePath()) && !StringUtils.startsWith(importApi.getModulePath(), "/")) {
|
||||
importApi.setModulePath("/" + importApi.getModulePath());
|
||||
}
|
||||
|
||||
boolean isSameRequest = false;
|
||||
ApiDefinitionBlob apiDefinitionBlob = existenceApiDefinitionBlobMap.get(existenceApi.getId());
|
||||
MsHTTPElement existenceMsHTTPElement = null;
|
||||
|
Loading…
Reference in New Issue
Block a user