Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Body: null when using .jsonBody to POST #842

Open
andrewcihon415 opened this issue Nov 19, 2022 · 0 comments
Open

Body: null when using .jsonBody to POST #842

andrewcihon415 opened this issue Nov 19, 2022 · 0 comments

Comments

@andrewcihon415
Copy link

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) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant