Permalink
Browse files

Fix for #26.

Fix based on patch by btatnall.
Response body will always be delivered on response completion.
  • Loading branch information...
1 parent dbae286 commit e040f5cc8fe0e8307b7a24a6f1fe4836026619ba @neotyk neotyk committed Feb 4, 2012
Showing with 3 additions and 1 deletion.
  1. +2 −0 src/clj/http/async/client/request.clj
  2. +1 −1 test/http/async/client/test.clj
View
2 src/clj/http/async/client/request.clj
@@ -255,6 +255,8 @@
onCompleted [this]
(do
(completed resp)
+ (when-not (realized? (:body resp))
+ (deliver (:body resp) nil))
(deliver (:done resp) true)))
(^{:tag void}
onThrowable [this #^Throwable t]
View
2 test/http/async/client/test.clj
@@ -598,7 +598,7 @@
(is (thrown-with-msg? RuntimeException #"Closed" (GET client "http://localhost:8123/")))))
(deftest extract-empty-body
- (let [resp (await (GET *client* "http://localhost:8123/empty"))]
+ (let [resp (GET *client* "http://localhost:8123/empty")]
(is (nil? (string resp)))))
;;(deftest profile-get-stream

0 comments on commit e040f5c

Please sign in to comment.