From e040f5cc8fe0e8307b7a24a6f1fe4836026619ba Mon Sep 17 00:00:00 2001 From: Hubert Iwaniuk Date: Sat, 4 Feb 2012 01:31:12 +0100 Subject: [PATCH] Fix for #26. Fix based on patch by btatnall. Response body will always be delivered on response completion. --- src/clj/http/async/client/request.clj | 2 ++ test/http/async/client/test.clj | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/clj/http/async/client/request.clj b/src/clj/http/async/client/request.clj index a034ff0..1450c34 100644 --- a/src/clj/http/async/client/request.clj +++ b/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] diff --git a/test/http/async/client/test.clj b/test/http/async/client/test.clj index 6dbae1f..ba91a4a 100644 --- a/test/http/async/client/test.clj +++ b/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