fuel
fuel copied to clipboard
Body: null when using .jsonBody to POST
I am trying to post data using ".jsonBody" but every time it tries to POST it returns a Body: null. Am I formatting the json incorrectly? Any suggestions?
var intHR = heartRateBpm.value.toInt()
data class tobesent(
var devID: String,
var currentDB: Float,
var currentHr: Int,
var userLatitude: Float,
var userLongitude: Float,
)
val send = tobesent("Andy",0f,intHR,0f,0f)
Fuel.post("https://smart-sense-dashboard.herokuapp.com/api/sensors/")
.header(Headers.AUTHORIZATION, "4a16b669-43bc-412a-8dad-18dc7fb199d9")
.jsonBody(Gson().toJson(send).toString())
.responseString()
.also { println(it) }