fix: postman导入报错
This commit is contained in:
parent
9760b70762
commit
1182aa78bf
|
@ -54,6 +54,9 @@ public abstract class PostmanAbstractParserParser<T> extends ApiImportAbstractPa
|
|||
* @return
|
||||
*/
|
||||
public String parseVariable(String value) {
|
||||
if (StringUtils.isBlank(value)) {
|
||||
return value;
|
||||
}
|
||||
try {
|
||||
Pattern pattern = Pattern.compile("(\\{\\{(.*?)\\}\\})");
|
||||
Matcher matcher = pattern.matcher(value);
|
||||
|
@ -107,7 +110,11 @@ public abstract class PostmanAbstractParserParser<T> extends ApiImportAbstractPa
|
|||
String k = parseVariable(item.getKey());
|
||||
String v = parseVariable(item.getValue());
|
||||
String desc = parseVariable(item.getDescription());
|
||||
keyValues.add(new KeyValue(k, v, desc, item.getContentType()));
|
||||
KeyValue keyValue = new KeyValue(k, v, desc, item.getContentType());
|
||||
if (StringUtils.isNotBlank(item.getType()) && StringUtils.equals("file", item.getType())) {
|
||||
keyValue.setType("file");
|
||||
}
|
||||
keyValues.add(keyValue);
|
||||
});
|
||||
return keyValues;
|
||||
}
|
||||
|
|
|
@ -798,6 +798,7 @@ public class ApiDefinitionService {
|
|||
if (i % 300 == 0) {
|
||||
sqlSession.flushStatements();
|
||||
}
|
||||
sqlSession.flushStatements();
|
||||
}
|
||||
//判断EsbData是否需要存储
|
||||
if (apiImport.getEsbApiParamsMap() != null && apiImport.getEsbApiParamsMap().size() > 0) {
|
||||
|
@ -819,7 +820,6 @@ public class ApiDefinitionService {
|
|||
if (!CollectionUtils.isEmpty(apiImport.getCases())) {
|
||||
importMsCase(apiImport, sqlSession, apiTestCaseMapper);
|
||||
}
|
||||
sqlSession.flushStatements();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue