Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'header-exception' of https://github.com/g1nn13/http.asy…

…nc.client into g1nn13-header-exception
  • Loading branch information...
commit 2b145a0fd052e969ee142e3f60bfce0e6db2c69c 2 parents 4b86d84 + c6bbad7
Hubert Iwaniuk authored
6 src/clj/http/async/client/headers.clj
View
@@ -45,10 +45,10 @@
([k default] (if (.containsKey hds k)
(v hds k)
default)))
- (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]
(lazy-seq
(when-let [pseq (seq plseq)]
5 test/http/async/client/test.clj
View
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.