Skip to content

Instantly share code, notes, and snippets.

@cap10morgan
Created July 18, 2013 22:13
Show Gist options
  • Save cap10morgan/6033586 to your computer and use it in GitHub Desktop.
Save cap10morgan/6033586 to your computer and use it in GitHub Desktop.
(ns reproduce-body-params-bug.core
(:require [ring.middleware.format-params :refer [wrap-restful-params]]
[compojure.core :refer [routes POST]]
[compojure.handler :refer [api]]))
(defn handle-post [request]
{:status 200
:headers {"Content-Type" "text/plain"}
:body (str (:body-params request))})
(defn assemble-routes []
(routes (POST "/" [] handle-post)))
(defn create-handler []
(fn [request]
((-> (assemble-routes)
api
wrap-restful-params)
request)))
(defn handler
"Ring handler"
[request]
((create-handler) request))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment