Fork me on GitHub

How do you fellow helixers fetch on the browser ? Do you use js/fetch or its wrapper or something else.


I use js/fetch


@U09LZR36F Do you use a library for promises ?


No I remember: lambdaisland pulls kitchen-async which pulls core-async which is on hold for 2021


I don't. I'm passing the JSON as a JavaScript object around


promesa looks well written/behaved wrapper. No dependencies, documentation.

Brandon Stubbs14:06:27

Yeah, I trust most of the funcool libs, they are battle tested in


@U015Y1A1N8Y Didn't knew about this project. Thank you for pointing it.

💙 1
geraldodev18:06:18 this p/try block from kitchen-async has no equivalent on promesa, so i changed the p/let inside the p/try to . That proves @U09LZR36F point, native .then and .catch are more than enough for operations. I'm using p/promise constructor on decode-body in case the implementation (its a multi-method) does not give a promise back.


the fetch operation is not being guarded by the p/try block, which opens the door to something wrong with it. the p/let block captures a response, the fetch api says it does not reject on 404 errors. it only rejects on network errors. the next promise operation is decode-body. I wonder how the p/try from kitchen-async is able to intercept rejected promises on the code. I know the code is there but my brain is not lispy enough to understand how. Is it really feasible ? because the native promise handling is dependent on chainning, and I think promises are different from exceptions semantically.


despite the kitchen-async dependency pulling core.async, I liked lambdaisland.fetch. It pairs with muuntanja at server side, which responds to content-type. It defaults to asking for transit content, and has multi-methods to decode body based on the content-type.