Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow multiple header values, merge the cookies

  • Loading branch information...
commit 6becb1a805f25ee5a05490b08b56ba750a57c5c8 1 parent f416aaa
@tomjack tomjack authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/clojure/http/client.clj
View
6 src/clojure/http/client.clj
@@ -63,7 +63,7 @@ or the error stream of connection, whichever is appropriate."
"Returns a map of the response headers from connection."
[connection]
(let [hs (.getHeaderFields connection)]
- (into {} (for [[k v] hs :when k] [k (first v)]))))
+ (into {} (for [[k v] hs :when k] [(keyword (.toLowerCase k)) (seq v)]))))
(defn- parse-cookies
"Returns a map of cookies when given the Set-Cookie string sent
@@ -111,8 +111,8 @@ by a server."
:code (.getResponseCode connection)
:msg (.getResponseMessage connection)
:method method
- :headers (dissoc headers "Set-Cookie")
+ :headers (dissoc headers :set-cookie)
;; This correctly implements case-insensitive lookup.
:get-header #(.getHeaderField connection (as-str %))
- :cookies (parse-cookies (headers "Set-Cookie"))
+ :cookies (apply merge (map parse-cookies (headers :set-cookie)))
:url (str (.getURL connection))})))
Please sign in to comment.
Something went wrong with that request. Please try again.