Browse files

Merge branch 'header-exception' of…

…nc.client into g1nn13-header-exception
  • Loading branch information...
2 parents 4b86d84 + c6bbad7 commit 2b145a0fd052e969ee142e3f60bfce0e6db2c69c @neotyk neotyk committed Sep 3, 2012
Showing with 7 additions and 4 deletions.
  1. +3 −3 src/clj/http/async/client/headers.clj
  2. +4 −1 test/http/async/client/test.clj
@@ -45,10 +45,10 @@
([k default] (if (.containsKey hds k)
(v hds k)
- (cons [m] (throw "Headers are read only."))
+ (cons [m] (throw (UnsupportedOperationException. "Form 'cons' not supported: headers are read only.")))
(count [] (.size hds))
- (assoc [k v] (throw "Headers are read only."))
- (without [k] (throw "Headers are read only"))
+ (assoc [k v] (throw (UnsupportedOperationException. "Form 'assoc' not supported: headers are read only.")))
+ (without [k] (throw (UnsupportedOperationException. "Form 'without' not supported: headers are read only")))
(seq [] ((fn thisfn [plseq]
(when-let [pseq (seq plseq)]
@@ -196,7 +196,10 @@
(deliver headers# hds)
[hds :abort]))
headers @headers#]
- (is (= (:test-header headers) "test-value"))))
+ (is (= (:test-header headers) "test-value"))
+ (is (thrown? UnsupportedOperationException (.cons ^clojure.lang.APersistentMap headers '())))
+ (is (thrown? UnsupportedOperationException (assoc ^clojure.lang.APersistentMap headers :a 1)))
+ (is (thrown? UnsupportedOperationException (.without ^clojure.lang.APersistentMap headers :a)))))
(deftest test-status-and-header-callbacks
(let [status# (promise)

0 comments on commit 2b145a0

Please sign in to comment.