Hi o/
I was using ruuter with some ring middleware: ring.middleware.params/wrap-params
and ring.middleware.keyword-params/wrap-keyword-params
from ring/ring-core "1.10.0"
The first one parses any payload in a request body a puts it in the :params
and :form-params
keys of the request map (it also parses any query params but I was using form params)
The second one turn to keywords the keys of the :params
map.
But I was getting an empty params map in my handler.
I noticed that in L108 and L109 of ruuter.core
there's:
(response (->> {:params (path+uri->path-params path uri)}
(merge req)))
in the route+req->response
function
Since it's using thread last it's overwriting the parsed form params from the middleware
(merge
;; form params from wrap-params ring middleware
{:params {:content "hello world"}}
;; empty query params from ruuter (OK since I don't have any in that route)
{:params {}})
;; => {:params {}}
I don't know if changing it to a thread first macro breaks anything ๐ค
(merge
;; empty query params from ruuter (OK since I don't have any in that route)
{:params {}}
;; form params from wrap-params ring middleware
{:params {:content "hello world"}})
;; => {:params {:content "hello world"}}