Skip to content

Instantly share code, notes, and snippets.

@neotyk
Forked from skuro/stunnr.core.clj
Created October 6, 2011 09:51
Show Gist options
  • Save neotyk/1267001 to your computer and use it in GitHub Desktop.
Save neotyk/1267001 to your computer and use it in GitHub Desktop.
stunnr.core.clj
(ns stunnr.core
(:require [http.async.client :as c]
[http.async.client.request :as r]))
(def results (atom []))
(def requests (atom []))
(def client (c/create-client))
(defn fetch-url [^String url]
(swap! requests conj
(let [req (r/prepare-request :get url)
res (apply r/execute-request
client req
(apply concat
(merge
r/*default-callbacks*
{:completed (fn [res]
(clojure.pprint/pprint (c/status res))
(swap! results conj res)
[true :continue])})))]
req)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment