今天小编在用eclipse处理项目时,需要在接口测试文档输入json,但是报错了:
Invalid character found in the request target The valid characters are defined in RFC 7230 and RFC 3986
另外提一下:用idea时没报错
解决方案:
在springboot的启动类中 添加:
@Bean
public ConfigurableServletWebServerFactory webServerFactory() {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
public void customize(Connector connector) {
connector.setProperty("relaxedQueryChars", "|{}[]");
}
});
return factory;
}