why is it not allowing request.body.string but instead request.body.tostring() works but NULL value is the result…
fun fetchJson() {
val url = “http://www.cnn.com”
val request = Request.Builder().url(url).build()
val client = OkHttpClient()
client.newCall(request).enqueue(object: Callback {
override fun onResponse(call: Call, response: Response) {
val body = request.body.toString()
println("abc"+body)
}
override fun onFailure(call: Call, e: IOException) {
println("Failed to excute request")
}
})
}