mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-02 03:58:33 +08:00
refactor: postman导入优化
This commit is contained in:
parent
cc3006b9a1
commit
f9f5ff86bd
@ -65,10 +65,12 @@ public abstract class ApiImportAbstractParser implements ApiImportParser {
|
||||
|
||||
protected ApiModule getSelectModule(String moduleId) {
|
||||
apiModuleService = CommonBeanFactory.getBean(ApiModuleService.class);
|
||||
if (StringUtils.isNotBlank(moduleId)) {
|
||||
if (StringUtils.isNotBlank(moduleId) && !StringUtils.equals("root", moduleId)) {
|
||||
ApiModule module = new ApiModule();
|
||||
ApiModuleDTO moduleDTO = apiModuleService.getNode(moduleId);
|
||||
if (moduleDTO != null) {
|
||||
BeanUtils.copyBean(module, moduleDTO);
|
||||
}
|
||||
return module;
|
||||
}
|
||||
return null;
|
||||
|
@ -61,6 +61,16 @@ public class PostmanParser extends ApiImportAbstractParser {
|
||||
MsHTTPSamplerProxy request = buildRequest(requestItem.getName(), url.getRaw(), requestDesc.getMethod());
|
||||
ApiDefinitionResult apiDefinition =
|
||||
buildApiDefinition(request.getId(), requestItem.getName(), url.getRaw(), requestDesc.getMethod());
|
||||
if (StringUtils.isNotBlank(request.getPath())) {
|
||||
String path = request.getPath().split("\\?")[0];
|
||||
path = path.replace("{{", "${");
|
||||
path = path.replace("}}", "}");
|
||||
request.setPath(path);
|
||||
apiDefinition.setPath(path);
|
||||
} else {
|
||||
request.setPath("/");
|
||||
apiDefinition.setPath("/");
|
||||
}
|
||||
parseBody(request.getBody(), requestDesc);
|
||||
request.setArguments(parseKeyValue(url.getQuery()));
|
||||
request.setHeaders(parseKeyValue(requestDesc.getHeader()));
|
||||
|
Loading…
Reference in New Issue
Block a user