Distractic
11/23/2023, 10:28 PMresponse.bodyAsText()
, the first time, I have a non empty string, but the second time, the value is empty
Is it possible to fix that ? Thanks in advancepitonite
11/24/2023, 2:40 AMSheheryar Umair
11/24/2023, 3:48 AMresponse.bodyAsText()
, and it was handled by default?pitonite
11/24/2023, 4:43 AMDistractic
11/24/2023, 8:25 AMDistractic
11/24/2023, 5:00 PMDistractic
11/24/2023, 5:10 PMDistractic
11/24/2023, 5:12 PMDistractic
11/24/2023, 5:18 PMHttpResponseValidator {
validateResponse { response ->
if (!response.status.isSuccess()) {
// First read here and is not empty
val text = response.bodyAsText()
if (text.isEmpty()) {
return@validateResponse
}
val jsonBody = json.parseToJsonElement(text).jsonObject
val errors = findErrorFromBody(jsonBody)
if (errors != null) {
throw MyException(errors)
}
}
}
}
val response = client.get {
url(myurl)
}
// Second read here and is empty
val text = response.bodyAsText()
pitonite
11/24/2023, 7:57 PMDistractic
11/24/2023, 7:58 PMDistractic
11/25/2023, 2:25 AM