Skip to content

Commit

Permalink
Merge pull request #16 from zoldar/more-elaborate-http-exceptions
Browse files Browse the repository at this point in the history
Make clj-http throw entire message, not just status code.
  • Loading branch information
Michael Klishin committed Oct 9, 2012
2 parents e94b923 + a6fc523 commit 5d3da47
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/clojure/clojurewerkz/neocons/rest.clj
Expand Up @@ -13,28 +13,31 @@
[^String s] [^String s]
(get (System/getenv) s)) (get (System/getenv) s))


(def ^{:private true}
global-options {:throw-entire-message? true})

(def ^{:private true} (def ^{:private true}
http-authentication-options {}) http-authentication-options {})


(defn GET (defn GET
[^String uri & {:as options}] [^String uri & {:as options}]
(io! (io!
(http/get uri (merge http-authentication-options options {:accept :json})))) (http/get uri (merge global-options http-authentication-options options {:accept :json}))))


(defn POST (defn POST
[^String uri &{:keys [body] :as options}] [^String uri &{:keys [body] :as options}]
(io! (io!
(http/post uri (merge http-authentication-options options {:accept :json :content-type :json :body body})))) (http/post uri (merge global-options http-authentication-options options {:accept :json :content-type :json :body body}))))


(defn PUT (defn PUT
[^String uri &{:keys [body] :as options}] [^String uri &{:keys [body] :as options}]
(io! (io!
(http/put uri (merge http-authentication-options options {:accept :json :content-type :json :body body})))) (http/put uri (merge global-options http-authentication-options options {:accept :json :content-type :json :body body}))))


(defn DELETE (defn DELETE
[^String uri &{:keys [body] :as options}] [^String uri &{:keys [body] :as options}]
(io! (io!
(http/delete uri (merge http-authentication-options options {:accept :json})))) (http/delete uri (merge global-options http-authentication-options options {:accept :json}))))






Expand Down

0 comments on commit 5d3da47

Please sign in to comment.