请求头请求过长,feign调用压缩导致解析失败问题
服务器报文
{“msg”:“JSON parse error: Illegal character ((CTRL-CHAR, code 31)): only regular white space (\r, \n, \t) is allowed between tokens; nested exception is com.fasterxml.jackson.core.JsonParseException: Illegal character ((CTRL-CHAR, code 31)): only regular white space (\r, \n, \t) is allowed between tokens\n at [Source: (PushbackInputStream); line: 1, column: 2]”,“code”:500}
原因
由于请求头过大,传输过程中,自动压缩,导致解析失败
解决方法
- Httpclient调用方式会进行压缩
- okHttp不进行压缩
改变feign的调用方式
-
引入jar包
io.github.openfeign feign-okhttp -
配置上开启httpHttpClient