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
dumrat 2021-01-17T17:50:38.005400Z

Hi, I have this effect:

:http-xhrio {:method          :get
                         :uri             "<http://localhost:8080/parse>"
                         :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"]

dumrat 2021-01-17T17:50:44.005600Z

Any idea about this?

p-himik 2021-01-17T17:53:39.005800Z

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.

dumrat 2021-01-17T17:56:05.006Z

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

p-himik 2021-01-17T17:58:46.006200Z

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.

👍 1