Skip to content

Commit

Permalink
Fix for #26.
Browse files Browse the repository at this point in the history
Fix based on patch by btatnall.
Response body will always be delivered on response completion.
  • Loading branch information
neotyk committed Feb 4, 2012
1 parent dbae286 commit e040f5c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/clj/http/async/client/request.clj
Expand Up @@ -255,6 +255,8 @@
onCompleted [this] onCompleted [this]
(do (do
(completed resp) (completed resp)
(when-not (realized? (:body resp))
(deliver (:body resp) nil))
(deliver (:done resp) true))) (deliver (:done resp) true)))
(^{:tag void} (^{:tag void}
onThrowable [this #^Throwable t] onThrowable [this #^Throwable t]
Expand Down
2 changes: 1 addition & 1 deletion test/http/async/client/test.clj
Expand Up @@ -598,7 +598,7 @@
(is (thrown-with-msg? RuntimeException #"Closed" (GET client "http://localhost:8123/"))))) (is (thrown-with-msg? RuntimeException #"Closed" (GET client "http://localhost:8123/")))))


(deftest extract-empty-body (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))))) (is (nil? (string resp)))))


;;(deftest profile-get-stream ;;(deftest profile-get-stream
Expand Down

0 comments on commit e040f5c

Please sign in to comment.