fix(接口测试): 修复请求体含特殊字符转换错误问题
--bug=1027363 --user=赵勇 【接口测试】github#25189,ms升级到V2.10版本后,请求体中json转义的数据,不能换行使用,之前换行使用的全部报错:JSON parse error: Illegal unquoted character https://www.tapd.cn/55049933/s/1386897 Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
parent
4e169f5aec
commit
dc7791f447
|
@ -48,6 +48,7 @@ public class JSONUtil {
|
|||
objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
|
||||
// 使用BigDecimal来序列化
|
||||
objectMapper.configure(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS, true);
|
||||
objectMapper.configure(com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true);
|
||||
// 设置JSON处理字符长度限制
|
||||
objectMapper.getFactory()
|
||||
.setStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(JSON.DEFAULT_MAX_STRING_LEN).build());
|
||||
|
|
|
@ -268,9 +268,6 @@ export default {
|
|||
onMessage(e) {
|
||||
this.loading = false;
|
||||
this.runningData = JSON.parse(e.data);
|
||||
if (this.runningData && this.runningData.total > 0) {
|
||||
this.setActiveName();
|
||||
}
|
||||
this.runningTotal = this.runningData.total;
|
||||
this.init(false);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.metersphere.utils;
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.StreamReadConstraints;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
|
@ -26,6 +27,7 @@ public class JsonUtils {
|
|||
objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
|
||||
// 使用BigDecimal来序列化
|
||||
objectMapper.configure(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS, true);
|
||||
objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true);
|
||||
// 设置JSON处理字符长度限制
|
||||
objectMapper.getFactory()
|
||||
.setStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(DEFAULT_MAX_STRING_LEN).build());
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.metersphere.commons.utils;
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.StreamReadConstraints;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
@ -31,10 +32,13 @@ public class JSON {
|
|||
objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
|
||||
// 使用BigDecimal来序列化
|
||||
objectMapper.configure(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS, true);
|
||||
|
||||
objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true);
|
||||
// 设置JSON处理字符长度限制
|
||||
objectMapper.getFactory()
|
||||
.setStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(DEFAULT_MAX_STRING_LEN).build());
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static String toJSONString(Object value) {
|
||||
|
|
Loading…
Reference in New Issue