Spring Cloud Feign 压缩配置导致的字符混乱(only regular white space )

 

[nio-9601-exec-2] .w.s.m.s.DefaultHandlerExceptionResolver : 
Resolved [org.springframework.http.converter.HttpMessageNotReadableException: 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<EOL> 
at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream); line: 1, column: 2]]

设置了  Feign  的访问压缩配置:

feign:
  compression:
    request:
      enabled: false
    response:
      enabled: false

关闭压缩请求就可以了,如果需要单独配置 Feign  请求在 接口方法上设置:

 @Headers({"acceptEncoding: gzip","contentType: application/json"})

 

posted on   悄悄的来,匆匆的走  阅读(1555)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 百万级群聊的设计实践
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
· 永远不要相信用户的输入:从 SQL 注入攻防看输入验证的重要性
· 全网最简单!3分钟用满血DeepSeek R1开发一款AI智能客服,零代码轻松接入微信、公众号、小程
· .NET 10 首个预览版发布,跨平台开发与性能全面提升

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示