fix(接口测试): 修复jsonpath断言判断null值失败的缺陷

--bug=1019569 --user=王孝刚
[接口测试]github#19637jsonpath断言,响应体中字段为null的值识别不到,导致断言失败
https://www.tapd.cn/55049933/s/1317177
This commit is contained in:
wxg0103 2022-12-19 21:06:45 +08:00 committed by wxg0103
parent 9965baba5f
commit c85972a808
1 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
package io.metersphere.utils;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import io.metersphere.vo.Condition;
import io.metersphere.vo.ElementCondition;
import net.minidev.json.JSONArray;
@ -106,7 +106,7 @@ public class DocumentUtils {
if (subj == null) {
str = "null";
} else if (subj instanceof Map) {
str = new Gson().toJson(subj);
str = new GsonBuilder().serializeNulls().create().toJson(subj);
} else if (!(subj instanceof Double) && !(subj instanceof Float)) {
str = subj.toString();
} else {