refactor(接口测试): 接口定义导入 har 文件报错修复

--bug=1009828 --user=周骏弘 【接口测试】github#9732,导入har包报错 https://www.tapd.cn/55049933/s/1099430
This commit is contained in:
junhong 2022-01-26 17:13:09 +08:00 committed by zhangdahai112
parent 3dd81a000d
commit 3bc4fe38ad
2 changed files with 8 additions and 3 deletions

View File

@ -243,8 +243,10 @@ public class HarParser extends HarAbstractParser {
return;
}
String contentType = content.mimeType;
body.setType(getBodyType(contentType));
body.setRaw(content.text);
if(body != null){
body.setType(getBodyType(contentType));
body.setRaw(content.text);
}
}
private String parseXmlBody(String xmlString) {

View File

@ -37,10 +37,13 @@ public class Body {
public boolean isValid() {
if (this.isKV()) {
return kvs.stream().anyMatch(KeyValue::isValid);
if(kvs != null){
return kvs.stream().anyMatch(KeyValue::isValid);
}
} else {
return StringUtils.isNotBlank(raw);
}
return false;
}
public boolean isKV() {