re-frame

https://github.com/Day8/re-frame/blob/master/docs/README.md https://github.com/Day8/re-frame/blob/master/docs/External-Resources.md
Rafał Wyszomirski 2020-10-24T17:50:53.229900Z

Hello. Can you recommend some http client that works nicely with re-frame/cljs?

p-himik 2020-10-24T17:51:50.230Z

https://github.com/day8/re-frame-http-fx for re-frame. It wraps cljs-ajax which you can use directly if you're not using re-frame.

Rafał Wyszomirski 2020-10-24T17:55:15.230300Z

Yes, that's what I am using currently. Unfortunately it returns response body only and I haven't found a good way to extract the whole response with status code and headers and such. Unless you know how to do it right in re-frame ;) I'm still learning so sorry if the question is obvious.

Rafał Wyszomirski 2020-10-24T17:55:43.230500Z

Other than that, I think http-fx is pretty cool

p-himik 2020-10-24T18:02:32.230800Z

Seems like specifying (ajax.ring/ring-response-format) as the response format might get you the headers and the status code. I haven't tried it though.

Rafał Wyszomirski 2020-10-24T18:05:53.231Z

Okay, thank you very much. I will try it out 👍

Rafał Wyszomirski 2020-10-24T18:23:25.231200Z

@p-himik Thanks for setting me up on the right track. I ended up using:

:response-format (ajax/ring-response-format {:format (ajax/json-response-format)})
Though I must say the documentation for it which says "`ring-response-format` takes one parameter: format" is not the same as "takes one paramater, which is a map that accepts one key only, i.e. :format that has to be one of response-formats listed earlier"... Anyway, thanks a lot 🙏

👍 1
p-himik 2020-10-24T18:24:16.231500Z

Source code is always the answer. :) More often with time I tend to consult it before the documentation.

👍 1
Rafał Wyszomirski 2020-10-24T18:27:15.231800Z

Yeah... I'm still getting accustomed to clj code but I was so frustrated that such an obvious thing took me 2 days...

👍 1