Skip to content

Instantly share code, notes, and snippets.

@ordnungswidrig
Created March 7, 2014 11:19
Show Gist options
  • Save ordnungswidrig/9409779 to your computer and use it in GitHub Desktop.
Save ordnungswidrig/9409779 to your computer and use it in GitHub Desktop.
Force 409 for post requests (untestet)
(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