Created
March 7, 2014 11:19
-
-
Save ordnungswidrig/9409779 to your computer and use it in GitHub Desktop.
Force 409 for post requests (untestet)
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
(defresource conflict-on-post | |
:post! (fn [ctx] (if (detect-conflict ctx) { ::conflict true})) | |
:respone-with-entity (fn [{conflict ::conflict}] (not conflict)) | |
:handle-no-content (fn [{conflict ::conflict}] | |
(when conflict | |
(-> (as-response "my-regular-response") | |
(assoc :status 409) ;; force status | |
(ring-response))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment