java -- @FeignClient request/return data is too large

background:

        During joint debugging today, I found that an error was reported when using @FeignClient to request. This probably means that the request data is too large and an error was reported during compression. This problem did not occur during local testing.

error message:

        

 

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

Request code:

Solution:

         Set the minimum upper limit for compressed packets. Set 2048 to a larger value so that your request packets will not be compressed and errors will be avoided.

feign:
  compression:
    request:
      enabled: true
      min-request-size: 2048
    response:
      enabled: false

        It stands to reason that the above can solve the problem, but my message is too big, so I still report an error. Just be direct and do not process your message data. It is simple and crude.

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

        The errors were basically gone, but there were still some errors. I found out later that I also configured the following parameters. After removing them, it became normal and the packets were not serialized.

# feign 配置
feign:
  sentinel:
    enabled: true
  okhttp:
    enabled: true

result:

        Problem solved, normal joint debugging

Guess you like

Origin blog.csdn.net/DGH2430284817/article/details/131086008