ngrunwald/ring-middleware-format — pull request #7 by ieure (2012-09-26 22:45:21+00:00)
Title: Don’t try to merge the body into `:params` if it’s not a map.

The existing implementation of `wrap-format-params` always tries to merge `:body-params` into `:params`. However, when the request payload is a JSON list instead of a JSON object, this causes an `IllegalArgumentException`:

```
actual: java.lang.IllegalArgumentException: Vector arg to map conj must be a pair
at clojure.lang.APersistentMap.cons (APersistentMap.java:34)
clojure.lang.RT.conj (RT.java:551)
clojure.core$conj.invoke (core.clj:83)
clojure.core$merge$fn__4155.invoke (core.clj:2631)
clojure.core$reduce1.invoke (core.clj:880)
clojure.core$reduce1.invoke (core.clj:871)
clojure.core$merge.doInvoke (core.clj:2631)
clojure.lang.RestFn.invoke (RestFn.java:421)
ring.middleware.format_params$wrap_format_params$fn__488.invoke (format_params.clj:59)
ring.middleware.test.format_params/fn (format_params.clj:132)
```

This patch only merges if the payload is a map, and adds a test. This has bitten me a couple times, and I'd really like to see an updated release which fixes it.