fix(接口测试): 修复创建场景报错的缺陷

This commit is contained in:
wxg0103 2023-04-18 16:33:18 +08:00 committed by fit2-zhao
parent cb8076dd23
commit 6f31c0964f
2 changed files with 3 additions and 3 deletions

View File

@ -1166,10 +1166,10 @@ public class Swagger3Parser extends SwaggerAbstractParser {
statusCodeInfo.put("content", buildContent(response, schemas));
statusCodeInfo.put("description", StringUtils.EMPTY);
JSONObject jsonObject = statusCode.getJSONObject(i);
if (jsonObject.optString("value") != null) {
if (StringUtils.isNotBlank(jsonObject.optString("value"))) {
statusCodeInfo.put("description", jsonObject.optString("value"));
}
if (jsonObject.optString("name") != null) {
if (StringUtils.isNotBlank(jsonObject.optString("name"))) {
responseBody.put(jsonObject.optString("name"), statusCodeInfo);
}
}

View File

@ -732,7 +732,7 @@ public class ApiScenarioService {
ElementUtil.dataFormatting(element);
scenarioWithBLOBs.setScenarioDefinition(element.toString());
}
if (StringUtils.isNotBlank(scenarioWithBLOBs.getEnvironmentJson())) {
if (scenarioWithBLOBs != null && StringUtils.isNotBlank(scenarioWithBLOBs.getEnvironmentJson())) {
ApiScenarioEnvRequest request = new ApiScenarioEnvRequest();
request.setEnvironmentEnable(false);
request.setDefinition(scenarioWithBLOBs.getScenarioDefinition());