Skip to content

Instantly share code, notes, and snippets.

@bizenn
Created September 16, 2011 08:09
Show Gist options
  • Save bizenn/1221511 to your computer and use it in GitHub Desktop.
Save bizenn/1221511 to your computer and use it in GitHub Desktop.
Simple script for inspection of clojure.contrib.http.agent
;; -*- mode: clojure; coding: utf-8-unix -*-
;; clojure.contrib.http.agentの動作検証用スクリプト
(ns http-agent-test.core
(:use [clojure.contrib.http.agent :as ha :only [http-agent stream status]]
[clojure.java.io :as io :only [output-stream copy]]))
(defn get-agent [url file]
(ha/http-agent url
:handler
(fn [this]
(with-open [out (io/output-stream file)]
(io/copy (stream this) out)))))
(defn wait&status [agt]
(result agt)
(status agt))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment