fix(IDEA插件): 修复新版本插件导入报错

This commit is contained in:
zhangdahai112 2022-10-18 17:28:59 +08:00 committed by zhangdahai112
parent 45721d1007
commit f60215c6fd
2 changed files with 3 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package io.metersphere.api.parse;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.NullNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy;
import io.metersphere.api.dto.definition.response.HttpResponse;
@ -146,7 +147,7 @@ public abstract class PostmanAbstractParserParser<T> extends ApiImportAbstractPa
if (StringUtils.equals(bodyMode, PostmanRequestBodyMode.RAW.value())) {
parseRawBody(body, postmanBody, bodyMode);
} else if (StringUtils.equalsAny(bodyMode, PostmanRequestBodyMode.FORM_DATA.value(), PostmanRequestBodyMode.URLENCODED.value())) {
String s1 = postmanBody.get(bodyMode).toString();
String s1 = Optional.ofNullable(postmanBody.get(bodyMode)).orElse(NullNode.getInstance()).toString();
String s = parseVariable(s1);
List<PostmanKeyValue> postmanKeyValues = JSON.parseArray(s, PostmanKeyValue.class);
body.setKvs(parseKeyValue(postmanKeyValues));

View File

@ -1350,7 +1350,7 @@ public class ApiDefinitionService {
if (exApiRequest.get("body") != null && apiRequest.get("body") != null) {
if (!StringUtils.equals(exApiRequest.get("body").toString(), apiRequest.get("body").toString())) {
if (apiSyncCaseRequest.getBody() && toUpdate) {
if (BooleanUtils.toBoolean(apiSyncCaseRequest.getBody()) && toUpdate) {
apiDefinition.setToBeUpdated(true);
apiDefinition.setToBeUpdateTime(System.currentTimeMillis());
}