Skip to content

Instantly share code, notes, and snippets.

@iantruslove
Last active August 29, 2015 13:57
Show Gist options
  • Save iantruslove/9632491 to your computer and use it in GitHub Desktop.
Save iantruslove/9632491 to your computer and use it in GitHub Desktop.
;; Option 1: Return the response
(with-authentication state-with-auth-creds
clj-http.client/post
"http://some.url/api"
{:accept :json :headers {"X-foo" "bar"}})
;-> {:status 200 :body "looks good"}
;; Option 2: Return a wrapped request method
(def authenticating-post
(with-authentication state-with-auth-creds clj-http.client/post))
(authenticating-post "http://some.url/api"
{:accept :json :headers {"X-foo" "bar"}})
;-> {:status 200 :body "looks good"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment