@camdez Thanks for the solution in the post how-to-send-http-requests-the-curl-way-or-help-with-http-clj
I am trying to send the data in the JSON body instead of query parameters.
It would be great if anyone help me out to achieve it.
(ns foo
(:require [clj-http.client :as client]
[clj-http.headers :as headers]))
(defn request [req]
(client/with-middleware [headers/wrap-header-map
client/wrap-query-params
client/wrap-url
client/wrap-output-coercion
client/wrap-method]
(client/request req)))
;; `:keys` here are just included for documentation
(defn curl [method url & {:keys [headers query-params] :as req}]
(request (merge req {:method method :url url})))
;; curl -X POST --header "Content-Type: application/json" -d "name=Bob" "http://google.com"
(curl :post "http://google.com" :headers {"Content-Type" "application/json"} :query-params {"name" "Bob"})