                       :expires "123"}}
         handler (constantly {:cookies cookies})
         resp    ((wrap-cookies handler) {})]
-    (is (= {"Set-Cookie" (list "a=b;Path=/;Secure;HttpOnly;Expires=123")}
-           (:headers resp)))))
+    (is (= {"Set-Cookie" #{"a=b" "Path=/" "Secure" "HttpOnly" "Expires=123"}}
+           (split-set-cookie (:headers resp))))))
 
 (deftest wrap-cookies-accepts-max-age-from-clj-time
   (let [cookies {"a" {:value "b", :path "/",

(ns ring.middleware.test.cookies
  (:use clojure.test
        ring.middleware.cookies
        [clj-time.core :only (interval date-time)]))

    (is (= {"Set-Cookie" (list "a=b")}
           (:headers resp)))))

(defn- split-set-cookie [headers]
  (letfn [(split-header [v] (set (mapcat #(str/split % #";") v)))]
    (update-in headers ["Set-Cookie"] split-header)))

(deftest wrap-cookies-set-extra-attrs
  (let [cookies {"a" {:value "b", :path "/", :secure true, :http-only true }}
        handler (constantly {:cookies cookies})
        resp    ((wrap-cookies handler) {})]
    (is (= {"Set-Cookie" #{"a=b" "Path=/" "Secure" "HttpOnly"}}
           (split-set-cookie (:headers resp))))))

(deftest wrap-cookies-always-assocs-map
  (let [req  {:headers {}}
