Lukasz Kalnik
02/29/2024, 10:03 AMHttpClient
, but throw on 4xx and 5xx?
expectSuccess
throws on redirects (3xx) as well.Aleksei Tirman [JB]
02/29/2024, 11:00 AMval client = HttpClient(CIO) {
HttpResponseValidator {
validateResponse { response ->
if (response.status.value >= 400) {
throw RuntimeException("Invalid response with status ${response.status}")
}
}
}
}
client.get("<http://httpbin.org/status/404>")
Lukasz Kalnik
02/29/2024, 11:12 AM