Clojure: I am using http-kit to post a request to a server, but it is not working well for me

clojure, http-kit

Solution

quoting from the example on the bttchina site:

# The order of params is critical for calculating a correct hash

clojure hash maps are unordered, and you cannot use a clojure hash map literal to provide the input if order is significant

Problem

NOTE: I resolved my issue. However, it took a number of incremental changes. If you happen upon this page, feel free to checkout my github below to see how I made this application work. I am using http-kit to post a request to btc-china. I want to use their trading api. I am able to do this just fine with python, but for some reason I keep getting 401s with clojure and http-kit. I've posted a snippit of code below which may show that I am not using http-kit correctly. In addition to that, here is a github for my full code if you wish to look at that: https://github.com/gilmaso/btc-trading Here are the btc-china api docs: http://btcchina.org/api-trade-documentation-en ``` (def options {:timeout 2000 ; ms :query-params (sorted-map :tonce tonce :accesskey access-key :requestmethod request-method :id tonce :method method :params "") :headers {"Authorization" auth-string "Json-Rpc-Tonce" tonce}}) (client/post (str "https://" base-url) options (fn [{:keys [status headers body error]}] ;; asynchronous handle response (if error (println "Failed, exception is " error) (println "Async HTTP GET: " status)))) ```

Original source