fix(Mock测试): 修复Mock测试自定义函数处理时,对query参数中的json格式数据不支持的问题

修复Mock测试自定义函数处理时,对query参数中的json格式数据不支持的问题
This commit is contained in:
song-tianyang 2021-12-21 16:17:42 +08:00 committed by song-tianyang
parent c96ff48464
commit 4142a2a8d0
1 changed files with 2 additions and 0 deletions

View File

@ -407,6 +407,8 @@ public class MockApiUtils {
JSONObject queryParamsObj = requestMockParams.getQueryParamsObj();
for (String key : queryParamsObj.keySet()) {
String value = String.valueOf(queryParamsObj.get(key));
value = StringUtils.replace(value, "\\", "\\\\");
value = StringUtils.replace(value, "\"", "\\\"");
scriptStringBuffer.append("requestParams.put(\"query." + key + "\",\"" + value + "\");\n");
}
}