Open pandeiro opened 9 years ago
Hi Murphy, I think the best way would be to make this configurable as a parameter to wrap-json-response and then build your own client with the stuff you need. I am aware that the get/post etc fns are tied to the default client. I think those fns should be changed so you can pass a client as the first parameter. Because of that I usually just call the request fn and use a map as arguments, and don't use those fns at all. It's a bit of a relict trying to have the same api as clj-http. I would like to improve this in the future. Unfortunately I'm on a surf trip at the moment and AFK most of the time. If you can send a PR with the changes to wrap-json-response I would merge that. Roman On 29 Oct 2015 4:53 p.m., "Murphy McMahon" notifications@github.com wrote:
I have a use-case like this: I need to talk JSON but there are keys in the third-party JSON payloads which are not keywordizable.
Currently (I think) this means that I can't use the niceties of the cljs-http.client namespace, which I was using extensively, because :keywordize-keys true is baked in to the json-response middleware included there.
Would it be possible / practical / a good thing for users to be able to somehow modify this default middleware? So that, for instance, I could do something like this:
(swap! cljs-http.client/default-middleware (partial remove (set cljs-http.client/wrap-json-response)))
Or is that a terrible idea? Thanks for listening!
— Reply to this email directly or view it on GitHub https://github.com/r0man/cljs-http/issues/79.
Roman! That's not unfortunate at all -- that is great! Enjoy the waves!
Anyhow yes I see your point, and I will send a PR for review soon.
I have a use-case like this: I need to talk JSON but there are keys in the third-party JSON payloads which are not keywordizable.
Currently (I think) this means that I can't use the niceties of the
cljs-http.client
namespace, which I was using extensively, because:keywordize-keys true
is baked in to the json-response middleware included there.Would it be possible / practical / a good thing for users to be able to somehow modify this default middleware? So that, for instance, I could do something like this:
Or is that a terrible idea? Thanks for listening!