Skip to content

Instantly share code, notes, and snippets.

@pbuckley-personal
Created May 17, 2012 18:19
Show Gist options
  • Select an option

  • Save pbuckley-personal/2720716 to your computer and use it in GitHub Desktop.

Select an option

Save pbuckley-personal/2720716 to your computer and use it in GitHub Desktop.
basic auth with clojure http.async
(defn fetch-url-with-auth
"Get a URL using HTML basic authentication"
[url username password]
(with-open [client (c/create-client)]
(let [resp (c/GET client url :auth {:user username :password password :preemptive true})]
(c/await resp)
(c/string resp))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment