Hey! Is the only way to get a HttpResponse from a ...
# ktor
h
Hey! Is the only way to get a HttpResponse from a call to set expectSuccess to false?
r
Hi, there are 3 options • set
expectSuccess = false
on client level • set
expectSuccess = false
on request level
Copy code
val response = client.get<HttpResponse>(...) { expectSuccess = false }
• catch
ResponseException
and read response from it
Copy code
val response = try {
  client.get(...)
} catch (cause: ResponseException) {
  cause.response
}
👍 2