今天在使用fegin时调用报错了,保错信息:JSON parse error: Illegal character ((CTRL-CHAR, code 31)): only regular white space (\r, \n, \t) is allowed between tokens…
解决方式锁了好多,最终在发送请求的时候添加了
@Headers({“acceptEncoding: gzip”,“contentType: application/json”})
@PostMapping(value = "staffVehicle/**/**", consumes = "application/json")
// 这句是新加的,然后就好了
@Headers({"acceptEncoding: gzip","contentType: application/json"})
void saveVehicle(@RequestBody VehicleDoorAliasSaveVo vo);
这是fegin的一个bug,目前已经解决了,原文链接https://github.com/OpenFeign/feign/issues/934
后来发现还是有问题。然后根据网上的说法删除feign配置中的compression段
# feign 配置
feign:
sentinel:
enabled: true
hystrix:
enabled: true
okhttp:
enabled: true
httpclient:
enabled: false
client:
config:
default:
connectTimeout: 10000
readTimeout: 60000
//下面的删除掉,或者设置为false
compression:
request:
enabled: true
response:
enabled: true