feign使用中报错处理JSON parse error: Illegal character ((CTRL-CHAR, code 31)): only regular white space...

6 篇文章 0 订阅
1 篇文章 0 订阅
今天在使用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
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值