fix(接口测试): 修复mock保存30M数据报错的缺陷

--bug=1033139 --user=王孝刚 【接口测试】github#27662,接口Mock 数据超过30M, 保存报错,接口500 https://www.tapd.cn/55049933/s/1446500
This commit is contained in:
wxg0103 2023-12-20 19:23:27 +08:00 committed by Craftsman
parent 900b443886
commit f2b2a95df4
1 changed files with 4 additions and 0 deletions

View File

@ -1,8 +1,10 @@
package io.metersphere.autoconfigure;
import com.fasterxml.jackson.core.StreamReadConstraints;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.metersphere.commons.utils.JSON;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.utils.LoggerUtil;
import org.apache.hc.client5.http.ConnectTimeoutException;
@ -81,6 +83,8 @@ public class RestTemplateConfig {
@Bean
public ObjectMapper objectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.getFactory()
.setStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(JSON.DEFAULT_MAX_STRING_LEN).build());
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return mapper;
}