You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 30, 2019. It is now read-only.
Thank you for that free software :-) I've noticed it doesn't support well nester parameters. However it's not that difficult. Would you accept a PR with a code like this?
(defn-kv-encoder-fn"Convert a [key value] pair into an \"k=v\" encoded string. Only recurs over maps, vectors and lists for the value."
[map->query-string path]
(fn [[key value]]
(let [[path-head & path-tail :as nested-path] (map #(cond (keyword? %) (name %)
:else %)
(conj (vec path) key))]
(cond (map? value) (map->query-string nested-path value)
(sequential? value) (map->query-string nested-path (into {} (map-indexed vector (vec value))))
:else (let [encoded-key (url-encode (str path-head (str/join (map #(str"[" % "]") path-tail))))
encoded-value (url-encode value)]
(str encoded-key "=" encoded-value))))))
(defnmap->query-string"Convert a nested map of parameters into a query string. Only recurs over maps, vectors and lists."
([input]
(map->query-string [] input))
([path input]
(->> input
sort
(map (kv-encoder-fn map->query-string path))
(str/join"&"))))
The text was updated successfully, but these errors were encountered:
Hello,
Thank you for that free software :-) I've noticed it doesn't support well nester parameters. However it's not that difficult. Would you accept a PR with a code like this?
The text was updated successfully, but these errors were encountered: