meafmira / bs-axios

Bucklescript bindings for axios
71 stars 23 forks source link

Sopport JSON body for POST?! #23

Open strdr4605 opened 5 years ago

strdr4605 commented 5 years ago

I use https://github.com/ryb73/ppx_decco to encode and decode the records and JSONs

To work with Axios I need to do

Axios.postData(url, mytype_encode(response) |> Obj.magic) |> then_(...)

did not try with GET but will be useful to have body and response as JSON?! What do you think?!

meafmira commented 5 years ago

@strdr4605 I'm not sure which types produces your ppx. What do you suggest?

strdr4605 commented 5 years ago

@meafmira, response is a record mytype_encode(response) returns Js.Json.t. Maybe bs-axios can do Obj.magic under the hood. and take Js.Json.t as a POST body and also return Js.Json.t?!