The ClojureScript cljs-ajax client library converts {:b [1 2]}
to b[0]=1&b[1]=2
For example:
(http/get "http://example.com" {:b [1 2]})
results in a request to:
"http://example.com?b[0]=1&b[1]=2"
How can I setup my ring middleware to handle this format on the server side? I would like to convert it back to the original structure:
{:b [1 2]}
I am using the middleware below, but it does not work properly:
(ring.middleware.keyword-params/wrap-keyword-params)
(ring.middleware.params/wrap-params :encoding encoding)
(ring.middleware.nested-params/wrap-nested-params)
There is no issue in middleware side. The issue is in cljs-ajax's
ajax.core/params-to-str
api. It is generating duplicate URL for different data format.For array, format should be
b[]=1&b[]=3
.