Skip to content

Instantly share code, notes, and snippets.

@dcmoore
Created May 16, 2014 01:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcmoore/89f3a7480918cd94732c to your computer and use it in GitHub Desktop.
Save dcmoore/89f3a7480918cd94732c to your computer and use it in GitHub Desktop.
PUT and DELETE methods
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