https://kotlinlang.org logo
#ktor
Title
# ktor
r

rocketraman

10/17/2018, 5:10 PM
For the ktor client with
JsonFeature
how do I deal with two possible response formats e.g. a normal response and an error response?
j

Jonas Bark

10/17/2018, 5:31 PM
are you getting the correct HTTP status code alongside the error response?
r

rocketraman

10/17/2018, 5:32 PM
Yeah, I think I figured it out already... do
call
, and then in the block, call
receive<Whatever>()
if status = 200.
👍 1
e

e5l

10/17/2018, 6:15 PM
Also
1.0-beta
introduce
expectSuccess
option: if status is fail -
get<...>
throws
BadStatusCode
exception