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

Open
himangshuj opened this Issue Mar 11, 2011 · 0 comments

Comments

Projects
None yet
1 participant

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))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment