ring-json-params icon indicating copy to clipboard operation
ring-json-params copied to clipboard

conflict with apache cxf json handler due to use of clj-json

Open himangshuj opened this issue 13 years ago • 0 comments

here we are using clj-json library to read json-strings, but that should be depreciated instead we should move to contrib.json

(:require [clojure.contrib.json :as json]// this is the change we need (defn- json-request? [req](if-let [#^String type %28:content-type req%29] %28not %28empty? %28re-find #"^application/%28vnd.+%29?json" type%29%29%29))

(defn wrap-json-params [handler](fn [req] %28if-let [body %28and %28json-request? req%29 %28:body req%29%29] %28let [bstr %28slurp body%29 json-params %28json/read-json bstr%29 req* %28assoc req :json-params json-params :params %28merge %28:params req%29 json-params%29%29] %28handler req*%29%29 %28handler req%29%29))

himangshuj avatar Mar 11 '11 07:03 himangshuj