diff --git a/src/com/cognitect/vase/actions.clj b/src/com/cognitect/vase/actions.clj index 228210d..7da7aa5 100644 --- a/src/com/cognitect/vase/actions.clj +++ b/src/com/cognitect/vase/actions.clj @@ -95,8 +95,22 @@ (defn merged-parameters [request] {:post [(map? %)]} - (let [{:keys [path-params params json-params edn-params]} request] - (merge (if (empty? path-params) {} (decode-map path-params)) params json-params edn-params))) + (let [{:keys [path-params params json-params transit-params edn-params]} request] + (merge (if (empty? path-params) {} (decode-map path-params)) + params + json-params + transit-params + edn-params))) + +(defn resolve-payload-parameter + [request] + ;; Using `or` instead of not-found to prevent unnecessary lookups/evaluation + (or (get-in request [:json-params :payload]) + (get-in request [:transit-params :payload]) + (get-in request [:edn-params :payload]) + ;; There's no technical reason not to support forms, + ;; except for the lack of symmetry wrt `:payload` + (:form-params request))) (def eav (juxt :e :a :v)) @@ -397,7 +411,7 @@ (let [;args# (merged-parameters ~'request) args# (mapv #(select-keys % ~(vec properties)) - (get-in ~'request [:json-params :payload])) + (resolve-payload-parameter ~'request)) tx-data# (~(tx-processor db-op) args#) conn# (:conn ~'request) response-body# (apply-tx