Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixes a issue that happens when the response headers contains only on…

…e 'set-cookie' entry.
  • Loading branch information...
commit e139a02ae59a04e2db59b3c439285f9c510557e8 1 parent 0337e36
@canassa authored
View
3  src/clj/http/async/client/headers.clj
@@ -64,7 +64,8 @@
"Creates cookies from headers."
[headers]
(if (contains? headers :set-cookie)
- (for [cookie-string (:set-cookie headers)]
+ (for [cookie-string (let [set-cookie (:set-cookie headers)]
+ (if (string? set-cookie) (vector set-cookie) set-cookie))]
(let [name-token (atom true)]
(into {}
(for [#^String cookie (.split cookie-string ";")]
View
12 test/http/async/client/test.clj
@@ -136,7 +136,7 @@
constraint (Constraint.)
mapping (ConstraintMapping.)
security (ConstraintSecurityHandler.)]
-
+
(.addBean srv loginSrv)
(doto constraint
(.setName Constraint/__BASIC_AUTH)
@@ -481,6 +481,16 @@
(is (thrown-with-msg? RuntimeException #"Too many connections 1" (GET client url)))
(is (not (failed? (await r1)))))))
+
+(deftest single-set-cookie
+ (let [resp (GET *client* "http://localhost:8123/cookie")
+ cookie (first (cookies resp))
+ header (headers resp)]
+ (is (string? (:set-cookie header)))
+ (is (= (:name cookie) "foo"))
+ (is (= (:value cookie) "bar"))))
+
+
(deftest await-string
(let [resp (GET *client* "http://localhost:8123/stream")
body (string (await resp))]
Please sign in to comment.
Something went wrong with that request. Please try again.