BUG描述
20240613-09:59:59.062|INFO|null|810184|xxx|xxx||8|http-nio-xxx-exec-1|com.xxx.jim.xxx.XXXController.?.?|MSG=接收到来自xxx的文件请求
headers:[host:"xxx", accept:"text/html,application/json,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", user-agent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36 Hutool", accept-encoding:"gzip, deflate", accept-language:"zh-CN,zh;q=0.8", content-type:"application/json;charset=UTF-8", cache-control:"no-cache", pragma:"no-cache"
......
查看网关之后发现返回的响应内容确实存在GZip编码
解决方案
在请求头上添加以下内容
headers.set(HttpHeaders.ACCEPT_ENCODING, "\t");
在参考博客上,还提到了两种解决方案,都写在这里:
addRequestHeader("Accept-Encoding", "");
或者.addHeader("Accept-Encoding", "\n");
参考博客
博客园大佬:https://www.cnblogs.com/timssd/p/5499490.html