diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java b/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java index 5a82a40eb6..86e93d64b8 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java @@ -7,7 +7,6 @@ import io.metersphere.api.dto.ApiTestImportRequest; import io.metersphere.api.dto.automation.ApiScenarioRequest; import io.metersphere.api.dto.automation.ReferenceDTO; import io.metersphere.api.dto.definition.*; -import io.metersphere.api.dto.definition.information.ApiDetailedInformationDTO; import io.metersphere.api.dto.definition.parse.ApiDefinitionImport; import io.metersphere.api.dto.definition.request.assertions.document.DocumentElement; import io.metersphere.api.dto.scenario.Body; @@ -178,12 +177,6 @@ public class ApiDefinitionController { return apiDefinitionService.getById(id); } - @GetMapping("/get/apiDetail/{id}") - @RequiresPermissions("PROJECT_API_DEFINITION:READ") - public ApiDetailedInformationDTO getApiDetail(@PathVariable String id) { - return apiDefinitionService.getApiDetail(id); - } - @PostMapping(value = "/run/debug", consumes = {"multipart/form-data"}) @MsAuditLog(module = OperLogModule.API_DEFINITION, type = OperLogConstants.DEBUG, title = "#request.name", project = "#request.projectId") public MsExecResponseDTO runDebug(@RequestPart("request") RunDefinitionRequest request, @RequestPart(value = "files", required = false) List bodyFiles) { diff --git a/backend/src/main/java/io/metersphere/api/controller/ShareInfoController.java b/backend/src/main/java/io/metersphere/api/controller/ShareInfoController.java index 7c16c32ccd..0cc9b81a5f 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ShareInfoController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ShareInfoController.java @@ -65,7 +65,7 @@ public class ShareInfoController { model.setId(id); model.setName(id); } - ApiDocumentInfoDTO returnDTO = apiDefinitionService.conversionModelToDTO(model,userIdMap); + ApiDocumentInfoDTO returnDTO = shareInfoService.conversionModelToDTO(model,userIdMap); returnList.add(returnDTO); } } @@ -78,7 +78,7 @@ public class ShareInfoController { ApiDocumentInfoDTO returnDTO = new ApiDocumentInfoDTO(); try { Map userIdMap = userService.queryName(); - returnDTO = apiDefinitionService.conversionModelToDTO(apiModel,userIdMap); + returnDTO = shareInfoService.conversionModelToDTO(apiModel,userIdMap); } catch (Exception e) { LogUtil.error(e); } diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/information/ApiDetailedInformationDTO.java b/backend/src/main/java/io/metersphere/api/dto/definition/information/ApiDetailedInformationDTO.java deleted file mode 100644 index f0db6720a9..0000000000 --- a/backend/src/main/java/io/metersphere/api/dto/definition/information/ApiDetailedInformationDTO.java +++ /dev/null @@ -1,13 +0,0 @@ -package io.metersphere.api.dto.definition.information; - -import io.metersphere.api.dto.definition.ApiDefinitionResult; -import io.metersphere.api.dto.share.ApiDocumentInfoDTO; -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class ApiDetailedInformationDTO { - private ApiDefinitionResult apiDefinition; - private ApiDocumentInfoDTO apiInfo; -} diff --git a/backend/src/main/java/io/metersphere/api/dto/share/ApiDocumentInfoDTO.java b/backend/src/main/java/io/metersphere/api/dto/share/ApiDocumentInfoDTO.java index ac58648b1d..bd3f1203b0 100644 --- a/backend/src/main/java/io/metersphere/api/dto/share/ApiDocumentInfoDTO.java +++ b/backend/src/main/java/io/metersphere/api/dto/share/ApiDocumentInfoDTO.java @@ -17,7 +17,6 @@ public class ApiDocumentInfoDTO { private String uri; private String name; private String status; - private String protocol; private String tags; private String modules; 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 909124e13a..ea30dddfe0 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -1,7 +1,6 @@ package io.metersphere.api.service; import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; @@ -11,7 +10,6 @@ import io.metersphere.api.dto.automation.ApiScenarioRequest; import io.metersphere.api.dto.automation.ReferenceDTO; import io.metersphere.api.dto.datacount.ApiDataCountResult; import io.metersphere.api.dto.definition.*; -import io.metersphere.api.dto.definition.information.ApiDetailedInformationDTO; import io.metersphere.api.dto.definition.parse.ApiDefinitionImport; import io.metersphere.api.dto.definition.parse.ApiDefinitionImportParserFactory; import io.metersphere.api.dto.definition.parse.Swagger3Parser; @@ -21,7 +19,6 @@ import io.metersphere.api.dto.definition.request.sampler.MsTCPSampler; import io.metersphere.api.dto.mockconfig.MockConfigImportDTO; import io.metersphere.api.dto.scenario.Scenario; import io.metersphere.api.dto.scenario.request.RequestType; -import io.metersphere.api.dto.share.ApiDocumentInfoDTO; import io.metersphere.api.dto.swaggerurl.SwaggerTaskResult; import io.metersphere.api.dto.swaggerurl.SwaggerUrlRequest; import io.metersphere.api.exec.api.ApiExecuteService; @@ -32,7 +29,6 @@ import io.metersphere.base.mapper.*; import io.metersphere.base.mapper.ext.*; import io.metersphere.commons.constants.*; import io.metersphere.commons.exception.MSException; -import io.metersphere.commons.json.JSONSchemaGenerator; import io.metersphere.commons.json.JSONSchemaToDocumentUtils; import io.metersphere.commons.json.JSONToDocumentUtils; import io.metersphere.commons.utils.*; @@ -125,8 +121,6 @@ public class ApiDefinitionService { @Resource private ApiDefinitionFollowMapper apiDefinitionFollowMapper; @Resource - private UserService userService; - @Resource @Lazy private TestPlanService testPlanService; @Resource @@ -2039,345 +2033,4 @@ public class ApiDefinitionService { } } - public ApiDetailedInformationDTO getApiDetail(String id) { - ApiDetailedInformationDTO informationDTO = new ApiDetailedInformationDTO(); - - ApiDefinitionResult result = this.getById(id); - - ApiDocumentInfoDTO returnDTO = new ApiDocumentInfoDTO(); - try { - Map userIdMap = userService.queryName(); - ApiDefinitionWithBLOBs definition = apiDefinitionMapper.selectByPrimaryKey(id); - returnDTO = this.conversionModelToDTO(definition,userIdMap); - } catch (Exception e) { - LogUtil.error(e); - } - - informationDTO.setApiDefinition(result); - informationDTO.setApiInfo(returnDTO); - return informationDTO; - } - - public ApiDocumentInfoDTO conversionModelToDTO(ApiDefinitionWithBLOBs apiModel, Map userIdMap) { - ApiDocumentInfoDTO apiInfoDTO = new ApiDocumentInfoDTO(); - JSONArray previewJsonArray = new JSONArray(); - if (apiModel != null) { - apiInfoDTO.setId(apiModel.getId()); - apiInfoDTO.setName(apiModel.getName()); - apiInfoDTO.setMethod(apiModel.getMethod()); - apiInfoDTO.setUri(apiModel.getPath()); - apiInfoDTO.setStatus(apiModel.getStatus()); - apiInfoDTO.setProtocol(apiModel.getProtocol()); - - if(StringUtils.isNotEmpty(apiModel.getTags())){ - JSONArray tagsArr = JSONArray.parseArray(apiModel.getTags()); - List tagList = new ArrayList<>(); - for(int i = 0;i < tagsArr.size();i ++){ - tagList.add(tagsArr.getString(i)); - } - if(!tagList.isEmpty()){ - apiInfoDTO.setTags(StringUtils.join(tagList,",")); - } - } - - apiInfoDTO.setResponsibler(userIdMap.get(apiModel.getUserId()) == null? apiModel.getUserId() : userIdMap.get(apiModel.getUserId()).getName()); - apiInfoDTO.setCreateUser(userIdMap.get(apiModel.getCreateUser()) == null? apiModel.getCreateUser() : userIdMap.get(apiModel.getCreateUser()).getName()); - apiInfoDTO.setDesc(apiModel.getDescription()); - ApiModuleService apiModuleService = CommonBeanFactory.getBean(ApiModuleService.class); - apiInfoDTO.setModules(apiModuleService.getModuleNameById(apiModel.getModuleId())); - - if (apiModel.getRequest() != null) { - JSONObject requestObj = this.genJSONObject(apiModel.getRequest()); - if (requestObj != null) { - if (requestObj.containsKey("headers")) { - JSONArray requestHeadDataArr = new JSONArray(); - //head赋值 - JSONArray headArr = requestObj.getJSONArray("headers"); - for (int index = 0; index < headArr.size(); index++) { - JSONObject headObj = headArr.getJSONObject(index); - if (headObj != null && headObj.containsKey("name") && headObj.containsKey("value")) { - requestHeadDataArr.add(headObj); - } - } - apiInfoDTO.setRequestHead(requestHeadDataArr.toJSONString()); - } - //url参数赋值 - JSONArray urlParamArr = new JSONArray(); - if (requestObj.containsKey("arguments")) { - try { - JSONArray headArr = requestObj.getJSONArray("arguments"); - for (int index = 0; index < headArr.size(); index++) { - - JSONObject headObj = headArr.getJSONObject(index); - if (headObj.containsKey("name") && headObj.containsKey("value")) { - urlParamArr.add(headObj); - } - } - } catch (Exception e) { - } - } - //rest参数设置 - JSONArray restParamArr = new JSONArray(); - if (requestObj.containsKey("rest")) { - try { - //urlParam -- rest赋值 - JSONArray headArr = requestObj.getJSONArray("rest"); - for (int index = 0; index < headArr.size(); index++) { - JSONObject headObj = headArr.getJSONObject(index); - if (headObj.containsKey("name")) { - restParamArr.add(headObj); - } - } - } catch (Exception e) { - } - } - apiInfoDTO.setUrlParams(urlParamArr.toJSONString()); - apiInfoDTO.setRestParams(restParamArr.toJSONString()); - //请求体参数类型 - if (requestObj.containsKey("body")) { - try { - JSONObject bodyObj = requestObj.getJSONObject("body"); - if (bodyObj.containsKey("type")) { - String type = bodyObj.getString("type"); - if (StringUtils.equals(type, "WWW_FORM")) { - apiInfoDTO.setRequestBodyParamType("x-www-from-urlencoded"); - } else if (StringUtils.equals(type, "Form Data")) { - apiInfoDTO.setRequestBodyParamType("form-data"); - } else { - apiInfoDTO.setRequestBodyParamType(type); - } - - if (StringUtils.equals(type, "JSON")) { - //判断是否是JsonSchema - boolean isJsonSchema = false; - if (bodyObj.containsKey("format")) { - String foramtValue = String.valueOf(bodyObj.get("format")); - if (StringUtils.equals("JSON-SCHEMA", foramtValue)) { - isJsonSchema = true; - } - } - if (isJsonSchema) { - apiInfoDTO.setRequestBodyParamType("JSON-SCHEMA"); - apiInfoDTO.setJsonSchemaBody(bodyObj); - if (bodyObj.containsKey("jsonSchema")) { - JSONObject jsonSchemaObj = bodyObj.getJSONObject("jsonSchema"); - apiInfoDTO.setRequestPreviewData(JSON.parse(JSONSchemaGenerator.getJson(jsonSchemaObj.toJSONString()))); - } - } else { - if (bodyObj.containsKey("raw")) { - String raw = bodyObj.getString("raw"); - apiInfoDTO.setRequestBodyStrutureData(raw); - //转化jsonObje 或者 jsonArray - this.setPreviewData(previewJsonArray, raw); - } - } - } else if (StringUtils.equalsAny(type, "XML", "Raw")) { - if (bodyObj.containsKey("raw")) { - String raw = bodyObj.getString("raw"); - apiInfoDTO.setRequestBodyStrutureData(raw); - this.setPreviewData(previewJsonArray, raw); - } - } else if (StringUtils.equalsAny(type, "Form Data", "WWW_FORM")) { - if (bodyObj.containsKey("kvs")) { - JSONArray bodyParamArr = new JSONArray(); - JSONArray kvsArr = bodyObj.getJSONArray("kvs"); - Map previewObjMap = new LinkedHashMap<>(); - for (int i = 0; i < kvsArr.size(); i++) { - JSONObject kv = kvsArr.getJSONObject(i); - if (kv.containsKey("name")) { - String value = ""; - if (kv.containsKey("value")) { - value = String.valueOf(kv.get("value")); - } - bodyParamArr.add(kv); - previewObjMap.put(String.valueOf(kv.get("name")), value); - } - } - this.setPreviewData(previewJsonArray, JSONObject.toJSONString(previewObjMap)); - apiInfoDTO.setRequestBodyFormData(bodyParamArr.toJSONString()); - } - } else if (StringUtils.equals(type, "BINARY")) { - if (bodyObj.containsKey("binary")) { - List> bodyParamList = new ArrayList<>(); - JSONArray kvsArr = bodyObj.getJSONArray("binary"); - - Map previewObjMap = new LinkedHashMap<>(); - for (int i = 0; i < kvsArr.size(); i++) { - JSONObject kv = kvsArr.getJSONObject(i); - if (kv.containsKey("description") && kv.containsKey("files")) { - Map bodyMap = new HashMap<>(); - String name = kv.getString("description"); - JSONArray fileArr = kv.getJSONArray("files"); - String value = ""; - for (int j = 0; j < fileArr.size(); j++) { - JSONObject fileObj = fileArr.getJSONObject(j); - if (fileObj.containsKey("name")) { - value += fileObj.getString("name") + " ;"; - } - } - bodyMap.put("name", name); - bodyMap.put("value", value); - bodyMap.put("contentType", "File"); - bodyParamList.add(bodyMap); - - previewObjMap.put(String.valueOf(name), String.valueOf(value)); - - } - } - this.setPreviewData(previewJsonArray, JSONObject.toJSONString(previewObjMap)); - apiInfoDTO.setRequestBodyFormData(JSONArray.toJSONString(bodyParamList)); - } - } - } - } catch (Exception e) { - - } - - } - } - } - - //赋值响应头 - if (apiModel.getResponse() != null) { - JSONObject responseJsonObj = this.genJSONObject(apiModel.getResponse()); - if (responseJsonObj != null && responseJsonObj.containsKey("headers")) { - try { - JSONArray responseHeadDataArr = new JSONArray(); - JSONArray headArr = responseJsonObj.getJSONArray("headers"); - for (int index = 0; index < headArr.size(); index++) { - JSONObject headObj = headArr.getJSONObject(index); - if (headObj.containsKey("name") && headObj.containsKey("value")) { - responseHeadDataArr.add(headObj); - } - } - apiInfoDTO.setResponseHead(responseHeadDataArr.toJSONString()); - } catch (Exception e) { - - } - } - // 赋值响应体 - if (responseJsonObj != null && responseJsonObj.containsKey("body")) { - try { - JSONObject bodyObj = responseJsonObj.getJSONObject("body"); - if (bodyObj.containsKey("type")) { - String type = bodyObj.getString("type"); - if (StringUtils.equals(type, "WWW_FORM")) { - apiInfoDTO.setResponseBodyParamType("x-www-from-urlencoded"); - } else if (StringUtils.equals(type, "Form Data")) { - apiInfoDTO.setResponseBodyParamType("form-data"); - } else { - apiInfoDTO.setResponseBodyParamType(type); - } - if (StringUtils.equalsAny(type, "JSON", "XML", "Raw")) { - - //判断是否是JsonSchema - boolean isJsonSchema = false; - if (bodyObj.containsKey("format")) { - String foramtValue = String.valueOf(bodyObj.get("format")); - if (StringUtils.equals("JSON-SCHEMA", foramtValue)) { - isJsonSchema = true; - } - } - if (isJsonSchema) { -// apiInfoDTO.setRequestBodyParamType("JSON-SCHEMA"); - apiInfoDTO.setResponseBodyParamType("JSON-SCHEMA"); - apiInfoDTO.setJsonSchemaResponseBody(bodyObj); -// apiInfoDTO.setJsonSchemaBody(bodyObj); - } else { - if (bodyObj.containsKey("raw")) { - String raw = bodyObj.getString("raw"); - apiInfoDTO.setResponseBodyStrutureData(raw); - //转化jsonObje 或者 jsonArray - this.setPreviewData(previewJsonArray, raw); - } - } - } else if (StringUtils.equalsAny(type, "Form Data", "WWW_FORM")) { - if (bodyObj.containsKey("kvs")) { - JSONArray bodyParamArr = new JSONArray(); - JSONArray kvsArr = bodyObj.getJSONArray("kvs"); - for (int i = 0; i < kvsArr.size(); i++) { - JSONObject kv = kvsArr.getJSONObject(i); - if (kv.containsKey("name")) { - bodyParamArr.add(kv); - } - } - apiInfoDTO.setResponseBodyFormData(bodyParamArr.toJSONString()); - } - } else if (StringUtils.equals(type, "BINARY")) { - if (bodyObj.containsKey("binary")) { - List> bodyParamList = new ArrayList<>(); - JSONArray kvsArr = bodyObj.getJSONArray("kvs"); - for (int i = 0; i < kvsArr.size(); i++) { - JSONObject kv = kvsArr.getJSONObject(i); - if (kv.containsKey("description") && kv.containsKey("files")) { - Map bodyMap = new HashMap<>(); - - String name = kv.getString("description"); - JSONArray fileArr = kv.getJSONArray("files"); - String value = ""; - for (int j = 0; j < fileArr.size(); j++) { - JSONObject fileObj = fileArr.getJSONObject(j); - if (fileObj.containsKey("name")) { - value += fileObj.getString("name") + " ;"; - } - } - bodyMap.put("name", name); - bodyMap.put("value", value); - bodyParamList.add(bodyMap); - } - } - apiInfoDTO.setResponseBodyFormData(JSONArray.toJSONString(bodyParamList)); - } - } - } - } catch (Exception e) { - - } - - } - // 赋值响应码 - if (responseJsonObj != null && responseJsonObj.containsKey("statusCode")) { - try { - JSONArray responseStatusDataArr = new JSONArray(); - JSONArray statusArr = responseJsonObj.getJSONArray("statusCode"); - for (int index = 0; index < statusArr.size(); index++) { - JSONObject statusObj = statusArr.getJSONObject(index); - if (statusObj.containsKey("name") && statusObj.containsKey("value")) { - responseStatusDataArr.add(statusObj); - } - } - apiInfoDTO.setResponseCode(responseStatusDataArr.toJSONString()); - } catch (Exception e) { - - } - } - } - } - if (!previewJsonArray.isEmpty()) { - apiInfoDTO.setRequestPreviewData(previewJsonArray); - } - apiInfoDTO.setSelectedFlag(true); - return apiInfoDTO; - } - - private void setPreviewData(JSONArray previewArray, String data) { - try { - JSONObject previewObj = JSONObject.parseObject(data); - previewArray.add(previewObj); - } catch (Exception e) { - } - try { - previewArray = JSONArray.parseArray(data); - } catch (Exception e) { - } - } - - private JSONObject genJSONObject(String request) { - JSONObject returnObj = null; - try { - returnObj = JSONObject.parseObject(request); - } catch (Exception e) { - } - return returnObj; - } } diff --git a/backend/src/main/java/io/metersphere/api/service/ShareInfoService.java b/backend/src/main/java/io/metersphere/api/service/ShareInfoService.java index 32952abdb9..4c18a644df 100644 --- a/backend/src/main/java/io/metersphere/api/service/ShareInfoService.java +++ b/backend/src/main/java/io/metersphere/api/service/ShareInfoService.java @@ -110,6 +110,331 @@ public class ShareInfoService { return true; } + public ApiDocumentInfoDTO conversionModelToDTO(ApiDefinitionWithBLOBs apiModel, Map userIdMap) { + ApiDocumentInfoDTO apiInfoDTO = new ApiDocumentInfoDTO(); + JSONArray previewJsonArray = new JSONArray(); + if (apiModel != null) { + apiInfoDTO.setId(apiModel.getId()); + apiInfoDTO.setName(apiModel.getName()); + apiInfoDTO.setMethod(apiModel.getMethod()); + apiInfoDTO.setUri(apiModel.getPath()); + apiInfoDTO.setStatus(apiModel.getStatus()); + + if(StringUtils.isNotEmpty(apiModel.getTags())){ + JSONArray tagsArr = JSONArray.parseArray(apiModel.getTags()); + List tagList = new ArrayList<>(); + for(int i = 0;i < tagsArr.size();i ++){ + tagList.add(tagsArr.getString(i)); + } + if(!tagList.isEmpty()){ + apiInfoDTO.setTags(StringUtils.join(tagList,",")); + } + } + + apiInfoDTO.setResponsibler(userIdMap.get(apiModel.getUserId()) == null? apiModel.getUserId() : userIdMap.get(apiModel.getUserId()).getName()); + apiInfoDTO.setCreateUser(userIdMap.get(apiModel.getCreateUser()) == null? apiModel.getCreateUser() : userIdMap.get(apiModel.getCreateUser()).getName()); + apiInfoDTO.setDesc(apiModel.getDescription()); + ApiModuleService apiModuleService = CommonBeanFactory.getBean(ApiModuleService.class); + apiInfoDTO.setModules(apiModuleService.getModuleNameById(apiModel.getModuleId())); + + if (apiModel.getRequest() != null) { + JSONObject requestObj = this.genJSONObject(apiModel.getRequest()); + if (requestObj != null) { + if (requestObj.containsKey("headers")) { + JSONArray requestHeadDataArr = new JSONArray(); + //head赋值 + JSONArray headArr = requestObj.getJSONArray("headers"); + for (int index = 0; index < headArr.size(); index++) { + JSONObject headObj = headArr.getJSONObject(index); + if (headObj != null && headObj.containsKey("name") && headObj.containsKey("value")) { + requestHeadDataArr.add(headObj); + } + } + apiInfoDTO.setRequestHead(requestHeadDataArr.toJSONString()); + } + //url参数赋值 + JSONArray urlParamArr = new JSONArray(); + if (requestObj.containsKey("arguments")) { + try { + JSONArray headArr = requestObj.getJSONArray("arguments"); + for (int index = 0; index < headArr.size(); index++) { + + JSONObject headObj = headArr.getJSONObject(index); + if (headObj.containsKey("name") && headObj.containsKey("value")) { + urlParamArr.add(headObj); + } + } + } catch (Exception e) { + } + } + //rest参数设置 + JSONArray restParamArr = new JSONArray(); + if (requestObj.containsKey("rest")) { + try { + //urlParam -- rest赋值 + JSONArray headArr = requestObj.getJSONArray("rest"); + for (int index = 0; index < headArr.size(); index++) { + JSONObject headObj = headArr.getJSONObject(index); + if (headObj.containsKey("name")) { + restParamArr.add(headObj); + } + } + } catch (Exception e) { + } + } + apiInfoDTO.setUrlParams(urlParamArr.toJSONString()); + apiInfoDTO.setRestParams(restParamArr.toJSONString()); + //请求体参数类型 + if (requestObj.containsKey("body")) { + try { + JSONObject bodyObj = requestObj.getJSONObject("body"); + if (bodyObj.containsKey("type")) { + String type = bodyObj.getString("type"); + if (StringUtils.equals(type, "WWW_FORM")) { + apiInfoDTO.setRequestBodyParamType("x-www-from-urlencoded"); + } else if (StringUtils.equals(type, "Form Data")) { + apiInfoDTO.setRequestBodyParamType("form-data"); + } else { + apiInfoDTO.setRequestBodyParamType(type); + } + + if (StringUtils.equals(type, "JSON")) { + //判断是否是JsonSchema + boolean isJsonSchema = false; + if (bodyObj.containsKey("format")) { + String foramtValue = String.valueOf(bodyObj.get("format")); + if (StringUtils.equals("JSON-SCHEMA", foramtValue)) { + isJsonSchema = true; + } + } + if (isJsonSchema) { + apiInfoDTO.setRequestBodyParamType("JSON-SCHEMA"); + apiInfoDTO.setJsonSchemaBody(bodyObj); + if (bodyObj.containsKey("jsonSchema")) { + JSONObject jsonSchemaObj = bodyObj.getJSONObject("jsonSchema"); + apiInfoDTO.setRequestPreviewData(JSON.parse(JSONSchemaGenerator.getJson(jsonSchemaObj.toJSONString()))); + } + } else { + if (bodyObj.containsKey("raw")) { + String raw = bodyObj.getString("raw"); + apiInfoDTO.setRequestBodyStrutureData(raw); + //转化jsonObje 或者 jsonArray + this.setPreviewData(previewJsonArray, raw); + } + } + } else if (StringUtils.equalsAny(type, "XML", "Raw")) { + if (bodyObj.containsKey("raw")) { + String raw = bodyObj.getString("raw"); + apiInfoDTO.setRequestBodyStrutureData(raw); + this.setPreviewData(previewJsonArray, raw); + } + } else if (StringUtils.equalsAny(type, "Form Data", "WWW_FORM")) { + if (bodyObj.containsKey("kvs")) { + JSONArray bodyParamArr = new JSONArray(); + JSONArray kvsArr = bodyObj.getJSONArray("kvs"); + Map previewObjMap = new LinkedHashMap<>(); + for (int i = 0; i < kvsArr.size(); i++) { + JSONObject kv = kvsArr.getJSONObject(i); + if (kv.containsKey("name")) { + String value = ""; + if (kv.containsKey("value")) { + value = String.valueOf(kv.get("value")); + } + bodyParamArr.add(kv); + previewObjMap.put(String.valueOf(kv.get("name")), value); + } + } + this.setPreviewData(previewJsonArray, JSONObject.toJSONString(previewObjMap)); + apiInfoDTO.setRequestBodyFormData(bodyParamArr.toJSONString()); + } + } else if (StringUtils.equals(type, "BINARY")) { + if (bodyObj.containsKey("binary")) { + List> bodyParamList = new ArrayList<>(); + JSONArray kvsArr = bodyObj.getJSONArray("binary"); + + Map previewObjMap = new LinkedHashMap<>(); + for (int i = 0; i < kvsArr.size(); i++) { + JSONObject kv = kvsArr.getJSONObject(i); + if (kv.containsKey("description") && kv.containsKey("files")) { + Map bodyMap = new HashMap<>(); + String name = kv.getString("description"); + JSONArray fileArr = kv.getJSONArray("files"); + String value = ""; + for (int j = 0; j < fileArr.size(); j++) { + JSONObject fileObj = fileArr.getJSONObject(j); + if (fileObj.containsKey("name")) { + value += fileObj.getString("name") + " ;"; + } + } + bodyMap.put("name", name); + bodyMap.put("value", value); + bodyMap.put("contentType", "File"); + bodyParamList.add(bodyMap); + + previewObjMap.put(String.valueOf(name), String.valueOf(value)); + + } + } + this.setPreviewData(previewJsonArray, JSONObject.toJSONString(previewObjMap)); + apiInfoDTO.setRequestBodyFormData(JSONArray.toJSONString(bodyParamList)); + } + } + } + } catch (Exception e) { + + } + + } + } + } + + //赋值响应头 + if (apiModel.getResponse() != null) { + JSONObject responseJsonObj = this.genJSONObject(apiModel.getResponse()); + if (responseJsonObj != null && responseJsonObj.containsKey("headers")) { + try { + JSONArray responseHeadDataArr = new JSONArray(); + JSONArray headArr = responseJsonObj.getJSONArray("headers"); + for (int index = 0; index < headArr.size(); index++) { + JSONObject headObj = headArr.getJSONObject(index); + if (headObj.containsKey("name") && headObj.containsKey("value")) { + responseHeadDataArr.add(headObj); + } + } + apiInfoDTO.setResponseHead(responseHeadDataArr.toJSONString()); + } catch (Exception e) { + + } + } + // 赋值响应体 + if (responseJsonObj != null && responseJsonObj.containsKey("body")) { + try { + JSONObject bodyObj = responseJsonObj.getJSONObject("body"); + if (bodyObj.containsKey("type")) { + String type = bodyObj.getString("type"); + if (StringUtils.equals(type, "WWW_FORM")) { + apiInfoDTO.setResponseBodyParamType("x-www-from-urlencoded"); + } else if (StringUtils.equals(type, "Form Data")) { + apiInfoDTO.setResponseBodyParamType("form-data"); + } else { + apiInfoDTO.setResponseBodyParamType(type); + } + if (StringUtils.equalsAny(type, "JSON", "XML", "Raw")) { + + //判断是否是JsonSchema + boolean isJsonSchema = false; + if (bodyObj.containsKey("format")) { + String foramtValue = String.valueOf(bodyObj.get("format")); + if (StringUtils.equals("JSON-SCHEMA", foramtValue)) { + isJsonSchema = true; + } + } + if (isJsonSchema) { +// apiInfoDTO.setRequestBodyParamType("JSON-SCHEMA"); + apiInfoDTO.setResponseBodyParamType("JSON-SCHEMA"); + apiInfoDTO.setJsonSchemaResponseBody(bodyObj); +// apiInfoDTO.setJsonSchemaBody(bodyObj); + } else { + if (bodyObj.containsKey("raw")) { + String raw = bodyObj.getString("raw"); + apiInfoDTO.setResponseBodyStrutureData(raw); + //转化jsonObje 或者 jsonArray + this.setPreviewData(previewJsonArray, raw); + } + } +// if (bodyObj.containsKey("raw")) { +// String raw = bodyObj.getString("raw"); +// apiInfoDTO.setResponseBodyStrutureData(raw); +// } + } else if (StringUtils.equalsAny(type, "Form Data", "WWW_FORM")) { + if (bodyObj.containsKey("kvs")) { + JSONArray bodyParamArr = new JSONArray(); + JSONArray kvsArr = bodyObj.getJSONArray("kvs"); + for (int i = 0; i < kvsArr.size(); i++) { + JSONObject kv = kvsArr.getJSONObject(i); + if (kv.containsKey("name")) { + bodyParamArr.add(kv); + } + } + apiInfoDTO.setResponseBodyFormData(bodyParamArr.toJSONString()); + } + } else if (StringUtils.equals(type, "BINARY")) { + if (bodyObj.containsKey("binary")) { + List> bodyParamList = new ArrayList<>(); + JSONArray kvsArr = bodyObj.getJSONArray("kvs"); + for (int i = 0; i < kvsArr.size(); i++) { + JSONObject kv = kvsArr.getJSONObject(i); + if (kv.containsKey("description") && kv.containsKey("files")) { + Map bodyMap = new HashMap<>(); + + String name = kv.getString("description"); + JSONArray fileArr = kv.getJSONArray("files"); + String value = ""; + for (int j = 0; j < fileArr.size(); j++) { + JSONObject fileObj = fileArr.getJSONObject(j); + if (fileObj.containsKey("name")) { + value += fileObj.getString("name") + " ;"; + } + } + bodyMap.put("name", name); + bodyMap.put("value", value); + bodyParamList.add(bodyMap); + } + } + apiInfoDTO.setResponseBodyFormData(JSONArray.toJSONString(bodyParamList)); + } + } + } + } catch (Exception e) { + + } + + } + // 赋值响应码 + if (responseJsonObj != null && responseJsonObj.containsKey("statusCode")) { + try { + JSONArray responseStatusDataArr = new JSONArray(); + JSONArray statusArr = responseJsonObj.getJSONArray("statusCode"); + for (int index = 0; index < statusArr.size(); index++) { + JSONObject statusObj = statusArr.getJSONObject(index); + if (statusObj.containsKey("name") && statusObj.containsKey("value")) { + responseStatusDataArr.add(statusObj); + } + } + apiInfoDTO.setResponseCode(responseStatusDataArr.toJSONString()); + } catch (Exception e) { + + } + } + } + } + if (!previewJsonArray.isEmpty()) { + apiInfoDTO.setRequestPreviewData(previewJsonArray); + } + apiInfoDTO.setSelectedFlag(true); + return apiInfoDTO; + } + + private JSONObject genJSONObject(String request) { + JSONObject returnObj = null; + try { + returnObj = JSONObject.parseObject(request); + } catch (Exception e) { + } + return returnObj; + } + + private void setPreviewData(JSONArray previewArray, String data) { + try { + JSONObject previewObj = JSONObject.parseObject(data); + previewArray.add(previewObj); + } catch (Exception e) { + } + try { + previewArray = JSONArray.parseArray(data); + } catch (Exception e) { + } + } /** * 生成 api接口文档分享信息 diff --git a/backend/src/main/java/io/metersphere/api/service/TcpApiParamService.java b/backend/src/main/java/io/metersphere/api/service/TcpApiParamService.java index ddce4081b3..299215dd04 100644 --- a/backend/src/main/java/io/metersphere/api/service/TcpApiParamService.java +++ b/backend/src/main/java/io/metersphere/api/service/TcpApiParamService.java @@ -1,16 +1,12 @@ package io.metersphere.api.service; -import com.alibaba.fastjson.JSONArray; import io.metersphere.api.dto.automation.TcpTreeTableDataStruct; import io.metersphere.api.dto.automation.parse.TcpTreeTableDataParser; import io.metersphere.api.dto.definition.SaveApiDefinitionRequest; import io.metersphere.api.dto.definition.request.sampler.MsTCPSampler; -import io.metersphere.api.dto.scenario.KeyValue; -import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.LogUtil; import io.metersphere.plugin.core.MsTestElement; import io.metersphere.utils.LoggerUtil; -import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -56,11 +52,7 @@ public class TcpApiParamService { if (testElement instanceof MsTCPSampler) { tcpSampler = (MsTCPSampler) testElement; String reportType = tcpSampler.getReportType(); - if (CollectionUtils.isNotEmpty(tcpSampler.getEsbDataStruct())) { - EsbApiParamService esbApiParamService = CommonBeanFactory.getBean(EsbApiParamService.class); - List keyValueList = esbApiParamService.genKeyValueListByDataStruct(tcpSampler, JSONArray.toJSONString(tcpSampler.getEsbDataStruct())); - tcpSampler.setParameters(keyValueList); - }else if (StringUtils.isNotEmpty(reportType)) { + if (StringUtils.isNotEmpty(reportType)) { switch (reportType) { case "raw": tcpSampler.setRequest(tcpSampler.getRawDataStruct()); diff --git a/frontend/src/business/components/api/definition/ApiDefinition.vue b/frontend/src/business/components/api/definition/ApiDefinition.vue index 15550673a3..849188ce71 100644 --- a/frontend/src/business/components/api/definition/ApiDefinition.vue +++ b/frontend/src/business/components/api/definition/ApiDefinition.vue @@ -495,9 +495,6 @@ export default { if (projectData && projectData.apiQuickMenu === 'api') { this.handleTabAdd("ADD"); } else { - let newApi = { - - }; this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug"); } }) diff --git a/frontend/src/business/components/api/definition/ApiDefinitionBaseView.vue b/frontend/src/business/components/api/definition/ApiDefinitionBaseView.vue deleted file mode 100644 index 2631417a30..0000000000 --- a/frontend/src/business/components/api/definition/ApiDefinitionBaseView.vue +++ /dev/null @@ -1,974 +0,0 @@ - - - - diff --git a/frontend/src/business/components/api/definition/components/apiinfo/ApiInfoContainer.vue b/frontend/src/business/components/api/definition/components/apiinfo/ApiInfoContainer.vue deleted file mode 100644 index 9621872699..0000000000 --- a/frontend/src/business/components/api/definition/components/apiinfo/ApiInfoContainer.vue +++ /dev/null @@ -1,314 +0,0 @@ - - - - - diff --git a/frontend/src/business/components/api/definition/components/apiinfo/edit/ApiBaseCaseInfo.vue b/frontend/src/business/components/api/definition/components/apiinfo/edit/ApiBaseCaseInfo.vue deleted file mode 100644 index 41c7dab7a1..0000000000 --- a/frontend/src/business/components/api/definition/components/apiinfo/edit/ApiBaseCaseInfo.vue +++ /dev/null @@ -1,166 +0,0 @@ - - - - - diff --git a/frontend/src/business/components/api/definition/components/apiinfo/edit/ApiBaseInfo.vue b/frontend/src/business/components/api/definition/components/apiinfo/edit/ApiBaseInfo.vue deleted file mode 100644 index a316d75611..0000000000 --- a/frontend/src/business/components/api/definition/components/apiinfo/edit/ApiBaseInfo.vue +++ /dev/null @@ -1,155 +0,0 @@ - - - - - diff --git a/frontend/src/business/components/api/definition/components/apiinfo/edit/ApiCaseEdit.vue b/frontend/src/business/components/api/definition/components/apiinfo/edit/ApiCaseEdit.vue deleted file mode 100644 index e1f839a1d1..0000000000 --- a/frontend/src/business/components/api/definition/components/apiinfo/edit/ApiCaseEdit.vue +++ /dev/null @@ -1,49 +0,0 @@ - - - - - diff --git a/frontend/src/business/components/api/definition/components/apiinfo/edit/ApiDefinitionEdit.vue b/frontend/src/business/components/api/definition/components/apiinfo/edit/ApiDefinitionEdit.vue deleted file mode 100644 index 4afa2968ed..0000000000 --- a/frontend/src/business/components/api/definition/components/apiinfo/edit/ApiDefinitionEdit.vue +++ /dev/null @@ -1,48 +0,0 @@ - - - - - diff --git a/frontend/src/business/components/api/definition/components/apiinfo/edit/ApiTestInfo.vue b/frontend/src/business/components/api/definition/components/apiinfo/edit/ApiTestInfo.vue deleted file mode 100644 index d6d4a364b1..0000000000 --- a/frontend/src/business/components/api/definition/components/apiinfo/edit/ApiTestInfo.vue +++ /dev/null @@ -1,229 +0,0 @@ - - - - - diff --git a/frontend/src/business/components/api/definition/components/apiinfo/edit/compnents/DubboBaseInfo.vue b/frontend/src/business/components/api/definition/components/apiinfo/edit/compnents/DubboBaseInfo.vue deleted file mode 100644 index 104a54d307..0000000000 --- a/frontend/src/business/components/api/definition/components/apiinfo/edit/compnents/DubboBaseInfo.vue +++ /dev/null @@ -1,330 +0,0 @@ - - - - - diff --git a/frontend/src/business/components/api/definition/components/apiinfo/edit/compnents/HttpBaseInfo.vue b/frontend/src/business/components/api/definition/components/apiinfo/edit/compnents/HttpBaseInfo.vue deleted file mode 100644 index 3dfea729af..0000000000 --- a/frontend/src/business/components/api/definition/components/apiinfo/edit/compnents/HttpBaseInfo.vue +++ /dev/null @@ -1,501 +0,0 @@ - - - - - diff --git a/frontend/src/business/components/api/definition/components/apiinfo/edit/compnents/SqlBaseInfo.vue b/frontend/src/business/components/api/definition/components/apiinfo/edit/compnents/SqlBaseInfo.vue deleted file mode 100644 index 896a27a272..0000000000 --- a/frontend/src/business/components/api/definition/components/apiinfo/edit/compnents/SqlBaseInfo.vue +++ /dev/null @@ -1,320 +0,0 @@ - - - - - diff --git a/frontend/src/business/components/api/definition/components/apiinfo/edit/compnents/TcpBaseInfo.vue b/frontend/src/business/components/api/definition/components/apiinfo/edit/compnents/TcpBaseInfo.vue deleted file mode 100644 index 8bc8ed350a..0000000000 --- a/frontend/src/business/components/api/definition/components/apiinfo/edit/compnents/TcpBaseInfo.vue +++ /dev/null @@ -1,391 +0,0 @@ - - - - - diff --git a/frontend/src/business/components/api/definition/components/apiinfo/information/ApiDefinitionInformation.vue b/frontend/src/business/components/api/definition/components/apiinfo/information/ApiDefinitionInformation.vue deleted file mode 100644 index e475615d95..0000000000 --- a/frontend/src/business/components/api/definition/components/apiinfo/information/ApiDefinitionInformation.vue +++ /dev/null @@ -1,578 +0,0 @@ - - - - - - diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue index 16590ca417..423cdf4b7d 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue @@ -345,7 +345,6 @@ export default { this.currentApi.request = item.request; this.currentApi.request.changeId = getUUID(); } - this.$emit("setSelectedCaseId",item.id); }, changePriority(row) { if (row.id) { @@ -465,7 +464,6 @@ export default { if (!hideAlert) { this.$emit('refresh'); } - this.$emit("saveCaseCallback"); } }, (error) => { this.isSave = false; diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue index f016063aac..315d7a1917 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue @@ -6,7 +6,7 @@ :api="api" @setEnvironment="setEnvironment" @addCase="addCase" - @saveCase="saveCase" + @saveCase="saveCase(apiCaseList[0])" :condition="condition" :priorities="priorities" :project-id="projectId" @@ -17,9 +17,8 @@ -
-
+ :api-case="apiCaseList[0]" ref="apiCaseItem"/>
@@ -68,8 +64,6 @@ export default { }, props: { createCase: String, - testUsers: Array, - useExternalUsers: Boolean, loaded: { type: Boolean, default: false @@ -85,7 +79,6 @@ export default { environment: "", priorities: CASE_ORDER, apiCaseList: [], - selectCaseId:"", batchLoadingIds: [], singleLoading: false, singleRunId: "", @@ -114,9 +107,6 @@ export default { this.api = this.currentApi; this.sysAddition(); }, - testUsers() { - this.maintainerOptions = this.testUsers; - } }, created() { this.api = this.currentApi; @@ -137,20 +127,13 @@ export default { }, }, methods: { - setSelectedCaseId(caseId){ - this.selectCaseId = caseId; - }, getMaintainerOptions() { - if (this.useExternalUsers) { - this.maintainerOptions = this.testUsers; - } else { - this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => { - this.maintainerOptions = response.data; - }); - } + this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => { + this.maintainerOptions = response.data; + }); }, - close() { - if (this.$refs.testCaseDrawer) { + close(){ + if(this.$refs.testCaseDrawer){ this.$refs.testCaseDrawer.close(); } }, @@ -213,17 +196,8 @@ export default { } this.visible = true; }, - saveCase(hideAlert) { - let index = 0; - if(this.selectCaseId && this.selectCaseId !== ''){ - for(let i = 0; i < this.apiCaseList.length; i++){ - if(this.apiCaseList[i].id === this.selectCaseId){ - index = i; - } - } - } - let item = this.apiCaseList[index]; - this.$refs.apiCaseItem[index].saveTestCase(item, hideAlert); + saveCase(item, hideAlert) { + this.$refs.apiCaseItem.saveTestCase(item, hideAlert); }, saveApiAndCase(api) { if (api && api.url) { diff --git a/frontend/src/business/components/api/definition/components/document/components/ApiInformation.vue b/frontend/src/business/components/api/definition/components/document/components/ApiInformation.vue index 979da49972..42f4a7d59b 100644 --- a/frontend/src/business/components/api/definition/components/document/components/ApiInformation.vue +++ b/frontend/src/business/components/api/definition/components/document/components/ApiInformation.vue @@ -1,6 +1,6 @@ diff --git a/frontend/src/business/components/api/definition/components/document/components/protocal/DubboInformation.vue b/frontend/src/business/components/api/definition/components/document/components/protocal/DubboInformation.vue deleted file mode 100644 index 4e7d125e01..0000000000 --- a/frontend/src/business/components/api/definition/components/document/components/protocal/DubboInformation.vue +++ /dev/null @@ -1,22 +0,0 @@ - - - - - diff --git a/frontend/src/business/components/api/definition/components/document/components/protocal/HttpInformation.vue b/frontend/src/business/components/api/definition/components/document/components/protocal/HttpInformation.vue deleted file mode 100644 index 08174c117d..0000000000 --- a/frontend/src/business/components/api/definition/components/document/components/protocal/HttpInformation.vue +++ /dev/null @@ -1,75 +0,0 @@ - - - - - diff --git a/frontend/src/business/components/api/definition/components/document/components/protocal/SqlApiInformation.vue b/frontend/src/business/components/api/definition/components/document/components/protocal/SqlApiInformation.vue deleted file mode 100644 index d2159002fd..0000000000 --- a/frontend/src/business/components/api/definition/components/document/components/protocal/SqlApiInformation.vue +++ /dev/null @@ -1,22 +0,0 @@ - - - - - diff --git a/frontend/src/business/components/api/definition/components/document/components/protocal/TcpInformation.vue b/frontend/src/business/components/api/definition/components/document/components/protocal/TcpInformation.vue deleted file mode 100644 index 29680925d5..0000000000 --- a/frontend/src/business/components/api/definition/components/document/components/protocal/TcpInformation.vue +++ /dev/null @@ -1,71 +0,0 @@ - - - - - diff --git a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue index 97531be987..ccb99a0254 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue @@ -213,7 +213,7 @@ :total="total"/> - @@ -63,13 +63,7 @@ sortable="custom" :fields-width="fieldsWidth" min-width="120" - :field="item"> - - + :field="item"/> - @@ -96,8 +95,7 @@ export default { }, props: { baseMockConfigData: {}, - versionName: String, - apiId: String, + versionName:String, isTcp: { type: Boolean, default: false, @@ -153,14 +151,6 @@ export default { }, }, methods: { - filterMockData() { - if (this.mockConfigData && this.mockConfigData.mockExpectConfigList) { - return this.mockConfigData.mockExpectConfigList.filter( - data => !this.tableSearch || data.name.toLowerCase().includes(this.tableSearch.toLowerCase())) - } else { - return []; - } - }, redirectToTest(row) { let requestParam = null; if (row && row.request) { diff --git a/frontend/src/business/components/api/definition/components/request/http/ApiHttpRequestForm.vue b/frontend/src/business/components/api/definition/components/request/http/ApiHttpRequestForm.vue index dec0c6f817..1e9a5f7470 100644 --- a/frontend/src/business/components/api/definition/components/request/http/ApiHttpRequestForm.vue +++ b/frontend/src/business/components/api/definition/components/request/http/ApiHttpRequestForm.vue @@ -5,8 +5,7 @@ - + {{ $t('api_test.request.headers') }}
{{ headers.length - 1 }}
@@ -14,20 +13,14 @@ - {{ - $t("commons.batch_add") - }} - + {{ $t("commons.batch_add") }} - + - + {{ $t('api_test.definition.request.query_param') }}
{{ request.arguments.length - 1 }}
@@ -35,20 +28,14 @@ - {{ - $t("commons.batch_add") - }} - + {{ $t("commons.batch_add") }} - + - + {{ $t('api_test.definition.request.rest_param') }}
@@ -57,14 +44,9 @@ - {{ - $t("commons.batch_add") - }} - + {{ $t("commons.batch_add") }} - + @@ -74,8 +56,7 @@ - + {{ $t('api_test.definition.request.auth_config') }} @@ -112,8 +93,7 @@
{{ request.ruleSize }}
- +
diff --git a/frontend/src/business/components/api/definition/components/response/ResponseText.vue b/frontend/src/business/components/api/definition/components/response/ResponseText.vue index b76eb1f39c..c1bab8bb91 100644 --- a/frontend/src/business/components/api/definition/components/response/ResponseText.vue +++ b/frontend/src/business/components/api/definition/components/response/ResponseText.vue @@ -56,6 +56,7 @@ this.isActive = !this.isActive; }, }, + mounted() { if (!this.response.headers) { return; diff --git a/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue b/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue index dac0a9b8d3..bc07bff00e 100644 --- a/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue +++ b/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue @@ -2,9 +2,7 @@
- {{ $t('project.version.name') }}: {{ apiData.versionName }} -
diff --git a/frontend/src/business/components/api/homepage/components/ApiInfoCard.vue b/frontend/src/business/components/api/homepage/components/ApiInfoCard.vue index 72c1c8009d..2079b9db30 100644 --- a/frontend/src/business/components/api/homepage/components/ApiInfoCard.vue +++ b/frontend/src/business/components/api/homepage/components/ApiInfoCard.vue @@ -1,5 +1,5 @@