File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 22 (:use [clojure.contrib.java-utils :only [as-str]]
33 [clojure.contrib.duck-streams :only [read-lines]]
44 [clojure.contrib.str-utils :only [str-join]])
5- (:import (java.net URL HttpURLConnection)))
5+ (:import (java.net URL HttpURLConnection URLEncoder) )))
66
77(def default-headers {" User-Agent" (str " Clojure/" (clojure-version )
88 " (+http://clojure.org)" ),
99 " Connection" " close" })
1010
11+ (defn url-encode
12+ " Wrapper around java.net.URLEncoder returning a (UTF-8) URL encoded
13+ representation of text."
14+ [text]
15+ (URLEncoder/encode text " UTF-8" ))
16+
1117(defn url
1218 " If u is an instance of java.net.URL then returns it without
1319modification, otherwise tries to instantiate a java.net.URL with
@@ -49,7 +55,7 @@ by a server."
4955(defn- create-cookie-string
5056 " Returns a string suitable for sending to the server in the
5157\" Cookie\" header when given a clojure map of cookies."
52- [cookie-map]
58+ [cookie-map]
5359 (str-join " ; " (map (fn [cookie]
5460 (str (as-str (key cookie))
5561 " ="
You can’t perform that action at this time.
0 commit comments