Fork me on GitHub
#cljsrn
<
2018-06-22
>
manu12:06:05

Hi! How do you retrieve body from a fetch? I was used to use the _bodyText property, but there isn't anymore.. now there is _bodyBlob that returns a Blob object..

carocad16:06:46

@manu -> response.json() or response.text()

manu16:06:54

I've already tried but they give a Promise. How I can take the body from that?

carocad16:06:45

(-> (js/fetch "")
    (.then #(.text %))
    (.then println))

manu09:06:45

Oh great! but I don't want to print the body, but I want is as output of my function and use it.. may I use core.async?

carocad11:06:25

sure I do it like that actually. Here is my code. Hope it helps: https://github.com/hiposfer/hive/blob/master/src/hive/services/raw/http.cljs#L19