fix(Mock测试): 修复Mock测试自定义函数处理时,对query参数中的json格式数据不支持的问题
修复Mock测试自定义函数处理时,对query参数中的json格式数据不支持的问题
This commit is contained in:
parent
c96ff48464
commit
4142a2a8d0
|
@ -407,6 +407,8 @@ public class MockApiUtils {
|
||||||
JSONObject queryParamsObj = requestMockParams.getQueryParamsObj();
|
JSONObject queryParamsObj = requestMockParams.getQueryParamsObj();
|
||||||
for (String key : queryParamsObj.keySet()) {
|
for (String key : queryParamsObj.keySet()) {
|
||||||
String value = String.valueOf(queryParamsObj.get(key));
|
String value = String.valueOf(queryParamsObj.get(key));
|
||||||
|
value = StringUtils.replace(value, "\\", "\\\\");
|
||||||
|
value = StringUtils.replace(value, "\"", "\\\"");
|
||||||
scriptStringBuffer.append("requestParams.put(\"query." + key + "\",\"" + value + "\");\n");
|
scriptStringBuffer.append("requestParams.put(\"query." + key + "\",\"" + value + "\");\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue