1

我正在尝试使用WSClientPlay 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.

我怎样才能正确压缩我的请求?

提前致谢

4

1 回答 1

0

不幸的是,我认为您不能压缩请求(底层库 Netty 不支持它)。您可以在https://github.com/AsyncHttpClient/async-http-client/issues/93https://github.com/netty/netty/issues/2132中找到更多信息

于 2016-12-08T14:19:13.413 回答