aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Sierra <mail@stuartsierra.com>2009-07-16 16:55:06 -0400
committerStuart Sierra <mail@stuartsierra.com>2009-07-16 16:55:06 -0400
commitb9bf473cde4bc7118d22a8abce06ab4b4f961a3f (patch)
tree64364ed7a0529114b21881b056c14e3878ef6ae6
parent63c2a5f673b77d2fb79daf58966ffe1d8222d426 (diff)
http/agent.clj: response-headers lower-cases header names
Preparation for possible compatibility with Ring, see http://github.com/mmcgrana/ring
-rw-r--r--src/clojure/contrib/http/agent.clj9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/clojure/contrib/http/agent.clj b/src/clojure/contrib/http/agent.clj
index e45d8880..dc770429 100644
--- a/src/clojure/contrib/http/agent.clj
+++ b/src/clojure/contrib/http/agent.clj
@@ -121,11 +121,12 @@
(.getResponseMessage (::connection @a))))
(defn response-headers
- "Returns a String=>String map of HTTP response headers. If a header
- appears more than once, only the last value is returned."
+ "Returns a String=>String map of HTTP response headers. Header
+ names are converted to all lower-case. If a header appears more
+ than once, only the last value is returned."
[a]
- (reduce (fn [m [k v]]
- (assoc m k (last v)))
+ (reduce (fn [m [#^String k v]]
+ (assoc m (when k (.toLowerCase k)) (last v)))
{} (.getHeaderFields (::connection @a))))
(defn response-headers-seq