From e45cd666412830d3e7625368a06717467a132d1b Mon Sep 17 00:00:00 2001 From: Andy Chambers Date: Tue, 14 Oct 2014 23:22:02 -0400 Subject: [PATCH] Don't discard HEAD. Fixes #148 --- src/liberator/core.clj | 6 ++---- test/test_flow.clj | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/liberator/core.clj b/src/liberator/core.clj index 4c325e3..6aa50c5 100644 --- a/src/liberator/core.clj +++ b/src/liberator/core.clj @@ -203,10 +203,8 @@ (merge-with merge {:headers (build-options-headers resource)} response) - - (= :head (:request-method request)) - (dissoc response :body) - :else response))) + + :else response))) (defmacro ^:private defhandler [name status message] `(defn ~name [context#] diff --git a/test/test_flow.clj b/test/test_flow.clj index 8b7521b..491e25f 100644 --- a/test/test_flow.clj +++ b/test/test_flow.clj @@ -123,12 +123,12 @@ (let [resp ((resource :exists? true :handle-ok "OK") (request :head "/"))] (fact resp => OK) (fact resp => (content-type "text/plain;charset=UTF-8")) - (fact resp => (no-body)))) + (fact resp => (body "OK")))) (facts "unexisting resource" (let [resp ((resource :exists? false :handle-not-found "NOT-FOUND") (request :head "/"))] (fact resp => NOT-FOUND) - (fact resp => (no-body)))) + (fact resp => (body "NOT-FOUND")))) (facts "on moved temporarily" (let [resp ((resource :exists? false