Skip to content

Instantly share code, notes, and snippets.

@bizenn
Created September 16, 2011 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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