Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't discard HEAD. Fixes #148 #180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/liberator/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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#]
Expand Down
4 changes: 2 additions & 2 deletions test/test_flow.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down