Skip to content

Commit

Permalink
Fix metosin#56 use :key-fn in wrap-json-kw-params
Browse files Browse the repository at this point in the history
  • Loading branch information
Deraen committed Mar 12, 2016
1 parent 6f7098c commit 8976b28
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ring/middleware/format_params.clj
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
(let [{:keys [predicate decoder options] :as opts} (impl/extract-options args)]
(wrap-format-params handler (assoc opts
:predicate (or predicate json-request?)
:decoder (or decoder (make-json-decoder (assoc options :key-fn true)))))))
:decoder (or decoder (make-json-decoder (merge {:key-fn true} options)))))))

(def ^:no-doc msgpack-request?
(make-type-request-pred #"^application/(vnd.+)?(x-)?msgpack"))
Expand Down
4 changes: 4 additions & 0 deletions test/ring/middleware/format_params_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
(:body-params ((wrap-json-params identity {:options {:key-fn key-fn}})
{:content-type "application/json"
:body (stream "{\"foo_bar\":\"bar\"}")}))))
(is (= {:foo-bar "bar"}
(:body-params ((wrap-json-kw-params identity {:options {:key-fn key-fn}})
{:content-type "application/json"
:body (stream "{\"foo_bar\":\"bar\"}")}))))
(is (= {:foo-bar "bar"}
(:body-params ((wrap-restful-params identity {:format-options {:json {:key-fn key-fn}}})
{:content-type "application/json"
Expand Down

0 comments on commit 8976b28

Please sign in to comment.