Fork me on GitHub
#re-frame
<
2021-01-17
>
dumrat17:01:38

Hi, I have this effect:

:http-xhrio {:method          :get
                         :uri             ""
                         :format          (ajax/json-request-format)
                         :body            (.stringify js/JSON (:cell-data db))
                         :timeout         8000                                           ;; optional see API docs
                         :response-format (ajax/json-response-format {:keywords? true})  ;; IMPORTANT!: You must provide this.
                         :on-success      [::good-http-result (assoc cell :data-value value)]
                         :on-failure      [::bad-http-result (assoc cell :data-value value)]}
But at the backend, this is what I see for body:
:body #object[org.eclipse.jetty.server.HttpInput 0x2ff0bd56 "org.eclipse.jetty.server.HttpInput@2ff0bd56"]

p-himik17:01:39

What you get in your :body depends on entirely on how you've built your backend. Given the documentation for HttpInput, seems like it's a regular input stream - just read it and you should get the body's contents.

dumrat17:01:05

So I have added wrap-json-body at the backend. But doesn't look like the body is getting picked for some reason

p-himik17:01:46

I still have no idea what exactly you're doing on your backend. But I can certainly state that it's not related to re-frame in any way. Given the :body #object[...] above, the content is there - you just have to read it from the stream.

👍 3
dumrat17:01:44

Any idea about this?