-
-
Save neotyk/1267001 to your computer and use it in GitHub Desktop.
stunnr.core.clj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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