如何使用 dakrone/clj-http 客户端发送 gzip 压缩请求?到目前为止我已经:
(http/post <<REDACTED>>
{:body (->> <<REDACTED>>
cheshire.core/generate-string
.getBytes
clj-http.util/gzip)
:content-type "application/json"
:content-encoding "gzip"
:as :json})
但是elasticsearch(我的例子中的服务器)给出了500个错误
Illegal character ((CTRL-CHAR, code 31)): only regular white space
。
有什么想法吗?
我猜你需要在服务器上启用 HTTP 压缩,例如。 G。在 Elasticsearch 配置中:
http.compression: true
:content-encoding
不是 clj-http
的可识别关键字。试试:header {"Content-Encoding" "gzip"}
。