From 8d6580248804b4e7a567d4d901e3ab094415aa3d Mon Sep 17 00:00:00 2001 From: Jianguo-Genius Date: Mon, 9 Sep 2024 14:37:39 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=AD=97=E6=AE=B5=E8=BF=9B=E8=A1=8Ctrim?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/HttpApiDefinitionImportAbstractParser.java | 12 ++++++------ .../api/parser/api/JmeterParserApiDefinition.java | 6 +++--- .../definition/ApiDefinitionImportService.java | 4 ++++ 3 files changed, 13 insertions(+), 9 deletions(-) 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