How or where do I pass options through to clj-http

27 views
Skip to first unread message

lawrence...@gmail.com

unread,
Oct 9, 2017, 3:47:53 PM10/9/17
to clojure-elasticsearch
I am looking here: 


I see that put takes a final argument which seems to be the options passed along to clj-http:

(defn put
  [^Connection conn ^String uri {:keys [body] :as options}]
  (parse-safely
    (:body (http/put uri (merge {:throw-exceptions throw-exceptions}
                                (.http-opts conn)
                                options
                                {:accept :json
                                 :body (json/encode body)})))))

So I tried: 

(esd/put db "facts-over-time" "deduplicaton" denormalized-id item {
                                                                              :throw-exceptions true
                                                                              :socket-timeout 5000
                                                                              :conn-timeout 5000
                                                                              })
     
But this gets me: 

{:error {:root_cause [{:type "illegal_argument_exception", :reason "request [/facts-over-time/deduplicaton/company-91511] contains unrecognized parameters: [conn-timeout] -> did you mean [timeout]?, [socket-timeout], [throw-exceptions]"}], :type "illegal_argument_exception", :reason "request [/facts-over-time/deduplicaton/company-91511] contains unrecognized parameters: [conn-timeout] -> did you mean [timeout]?, [socket-timeout], [throw-exceptions]"}

But if I look here:


I see POST examples that I assume also apply to PUT:
;; Various options:
(client/post "http://example.com/api"
  {:basic-auth ["user" "pass"]
   :body "{\"json\": \"input\"}"
   :headers {"X-Api-Version" "2"}
   :content-type :json
   :socket-timeout 1000  ;; in milliseconds
   :conn-timeout 1000    ;; in milliseconds
   :accept :json})

How or where do I pass options through to clj-http? 



Reply all
Reply to author
Forward
0 new messages