Created
May 16, 2014 01:26
-
-
Save dcmoore/89f3a7480918cd94732c to your computer and use it in GitHub Desktop.
PUT and DELETE methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HTML Hidden Form Field | |
<form action="/wherever" id="something" method="post"> | |
<input type="hidden" name="_method" value="put"/> | |
</form> | |
Clojure Middleware | |
(defn- change-to-put-and-delete [request] | |
(let [intended-request-method (get (:form-params request) "_method")] | |
(case intended-request-method | |
"put" (assoc request :request-method :put) | |
"delete" (assoc request :request-method :delete) | |
request))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment