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 2022-11-22 17:22  悄悄的来,匆匆的走  阅读(1490)  评论(0编辑  收藏  举报

导航