Skip to content

Commit

Permalink
RabbitMQ expects all request to also have a declared content type of
Browse files Browse the repository at this point in the history
  • Loading branch information
smee committed Jul 30, 2013
1 parent 1a7be8f commit 0b34989
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/clojure/langohr/http.clj
Expand Up @@ -32,17 +32,17 @@

(defn post
[^String uri &{:keys [body] :as options}]
(io! (:body (http/post uri (merge options {:accept :json :basic-auth [*username* *password*] :body (json/encode body)}))) true))
(io! (:body (http/post uri (merge options {:accept :json :basic-auth [*username* *password*] :body (json/encode body) :content-type "application/json"}))) true))

(defn put
[^String uri &{:keys [body] :as options}]
(io! (:body (http/put uri (merge options {:accept :json :basic-auth [*username* *password*] :body (json/encode body) :throw-exceptions throw-exceptions}))) true))
(io! (:body (http/put uri (merge options {:accept :json :basic-auth [*username* *password*] :body (json/encode body) :throw-exceptions throw-exceptions :content-type "application/json"}))) true))

(defn get
([^String uri]
(io! (json/decode (:body (http/get uri {:accept :json :basic-auth [*username* *password*] :throw-exceptions throw-exceptions})) true)))
(io! (json/decode (:body (http/get uri {:accept :json :basic-auth [*username* *password*] :throw-exceptions throw-exceptions :content-type "application/json"})) true)))
([^String uri &{:as options}]
(io! (json/decode (:body (http/get uri (merge options {:accept :json :basic-auth [*username* *password*] :throw-exceptions throw-exceptions}))) true))))
(io! (json/decode (:body (http/get uri (merge options {:accept :json :basic-auth [*username* *password*] :throw-exceptions throw-exceptions :content-type "application/json"}))) true))))

(defn head
[^String uri]
Expand Down Expand Up @@ -118,7 +118,7 @@

(defn declare-exchange
[^String vhost ^String exchange properties]
(post (url-with-path (format "/api/exchanges/%s/%s" (URLEncoder/encode vhost) (URLEncoder/encode exchange))) :body (json/generate-string properties)))
(put (url-with-path (format "/api/exchanges/%s/%s" (URLEncoder/encode vhost) (URLEncoder/encode exchange))) :body properties))

(defn delete-exchange
[^String vhost ^String exchange]
Expand Down Expand Up @@ -148,7 +148,7 @@

(defn declare-queue
[^String vhost ^String queue properties]
(post (url-with-path (format "/api/queues/%s/%s" (URLEncoder/encode vhost) (URLEncoder/encode queue))) :body (json/generate-string properties)))
(put (url-with-path (format "/api/queues/%s/%s" (URLEncoder/encode vhost) (URLEncoder/encode queue))) :body properties))

(defn delete-queue
[^String vhost ^String queue]
Expand Down

0 comments on commit 0b34989

Please sign in to comment.