diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/parser/api/HttpApiDefinitionImportAbstractParser.java b/backend/services/api-test/src/main/java/io/metersphere/api/parser/api/HttpApiDefinitionImportAbstractParser.java index b2f050e862..d4d37f9933 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/parser/api/HttpApiDefinitionImportAbstractParser.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/parser/api/HttpApiDefinitionImportAbstractParser.java @@ -77,12 +77,12 @@ public abstract class HttpApiDefinitionImportAbstractParser 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; } diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/parser/api/JmeterParserApiDefinition.java b/backend/services/api-test/src/main/java/io/metersphere/api/parser/api/JmeterParserApiDefinition.java index 83bb04c62d..5b6a800a47 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/parser/api/JmeterParserApiDefinition.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/parser/api/JmeterParserApiDefinition.java @@ -100,10 +100,10 @@ public class JmeterParserApiDefinition implements ApiDefinitionImportParser