We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
Using clj-http library to create a clojure curl style command
TODO: can this be re-implmented with http-kit/client ?
(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` 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"})
To send the request as a body
(curl :post "http://google.com" :headers {"Content-Type" "application/json"} :body '{"name" "Bob"}')
Sorry, something went wrong.
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: