使用clj-http发送gzip请求

时间:2018-09-21 14:04:14

标签: clojure gzip clj-http

如何使用dakrone / clj-http客户端发送压缩请求?到目前为止,我有:

(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

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

我想您需要在服务器上启用HTTP压缩,例如G。在Elasticsearch配置中:

http.compression: true