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

Distractic

11/03/2023, 11:05 PM
Hello ! I'm working with a weird API that has two possible responses. Globally, I receive a 200 code but the response body can change:
Copy code
{
 ...
 "data": { // error case
  "errors": [ .. ]
 }
 ...
}
or
Copy code
{
 ...
 "data": { // real object here
  "key1": "..",
  "key2": ".."
 }
 ...
}
So to simplify the error management, I would like to use Response validator but if I read the body in the validationResponse, I can't read it where the call is processed. Have you a solution about that ?
e

ephemient

11/03/2023, 11:32 PM
a

Andreas Scheja

11/03/2023, 11:38 PM
d

Distractic

11/04/2023, 1:02 AM
Thanks for your help !