diff --git a/backend/src/main/java/io/metersphere/api/dto/mock/MockApiUtils.java b/backend/src/main/java/io/metersphere/api/dto/mock/MockApiUtils.java index fc73959566..9c281ecc39 100644 --- a/backend/src/main/java/io/metersphere/api/dto/mock/MockApiUtils.java +++ b/backend/src/main/java/io/metersphere/api/dto/mock/MockApiUtils.java @@ -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"); } }