From 1eaa4a53a74963310c983025b22717e789ff0d7d Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Fri, 6 May 2022 16:20:09 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89=E5=AF=BC?= =?UTF-8?q?=E5=85=A5metersphere=E6=A0=BC=E5=BC=8F=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1013014 --user=王孝刚 【接口测试】导入接口文件-格式为metersphere-导入提示格式错误-导入失败 https://www.tapd.cn/55049933/s/1153505 --- .../api/dto/definition/parse/MsDefinitionParser.java | 2 +- .../java/io/metersphere/api/service/ApiDefinitionService.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/parse/MsDefinitionParser.java b/backend/src/main/java/io/metersphere/api/dto/definition/parse/MsDefinitionParser.java index 25269fae5d..f0a8d55d14 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/parse/MsDefinitionParser.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/parse/MsDefinitionParser.java @@ -31,7 +31,7 @@ public class MsDefinitionParser extends MsAbstractParser { @Override public ApiDefinitionImport parse(InputStream source, ApiTestImportRequest request) { String testStr = getApiTestStr(source); - JSONObject testObject = JSONObject.parseObject(testStr, Feature.OrderedField); + JSONObject testObject = JSONObject.parseObject(testStr, Feature.DisableSpecialKeyDetect); this.projectId = request.getProjectId(); if (StringUtils.isNotBlank(request.getModuleId())) { this.selectModule = ApiDefinitionImportUtil.getSelectModule(request.getModuleId()); diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index 27f9b834ac..afb2ebc788 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -993,7 +993,7 @@ public class ApiDefinitionService { private String setImportHashTree(ApiDefinitionWithBLOBs apiDefinition) { String request = apiDefinition.getRequest(); - MsHTTPSamplerProxy msHTTPSamplerProxy = JSONObject.parseObject(request, MsHTTPSamplerProxy.class); + MsHTTPSamplerProxy msHTTPSamplerProxy = JSONObject.parseObject(request, MsHTTPSamplerProxy.class, Feature.DisableSpecialKeyDetect); msHTTPSamplerProxy.setId(apiDefinition.getId()); msHTTPSamplerProxy.setHashTree(new LinkedList<>()); apiDefinition.setRequest(JSONObject.toJSONString(msHTTPSamplerProxy)); @@ -1002,7 +1002,7 @@ public class ApiDefinitionService { private String setImportTCPHashTree(ApiDefinitionWithBLOBs apiDefinition) { String request = apiDefinition.getRequest(); - MsTCPSampler tcpSampler = JSONObject.parseObject(request, MsTCPSampler.class); + MsTCPSampler tcpSampler = JSONObject.parseObject(request, MsTCPSampler.class, Feature.DisableSpecialKeyDetect); tcpSampler.setId(apiDefinition.getId()); tcpSampler.setHashTree(new LinkedList<>()); apiDefinition.setRequest(JSONObject.toJSONString(tcpSampler));