我正在尝试使用WSClient
Play Framework 中的 API 调用 Web 服务。主要问题是我想在不超过最大有效负载大小的情况下传输巨大的 JSON 有效负载(超过 2MB)。
为此,我想使用 gzip 压缩请求(带有 HTTP 标头Content-Encoding: gzip
)。在文档中,提到了该参数play.ws.compressionEnabled
,但它似乎只启用 WSResponse 压缩。
我尝试手动压缩有效负载(使用 GZipOutputStream)并放置 header Content-Encoding:gzip
,但服务器抛出io.netty.handler.codec.compression.DecompressionException : Unsupported compression method 191 in the GZIP header
.
我怎样才能正确压缩我的请求?
提前致谢