Ruben Quadros
11/25/2021, 3:53 PMHttpResponsePipeline.Transform
for that. I want to know if we can parse error response from server as well at this point? Any help would be great! Code in thread.client.responsePipeline.intercept(HttpResponsePipeline.Transform) { (info, body) ->
val response = if (context.response.status == HttpStatusCode.OK) {
//transform to success response
SuccessResponse(body)
} else {
//read error response body?
}
proceedWith(HttpResponseContainer(info, response))
}
val response: MyCustomResponse = client.get("some url")
{
"name": "NAME",
"message": "MESSAGE"
}
and error response as:
{
"error": "ERROR",
"message": "MESSAGE"
}
Aleksei Tirman [JB]
11/26/2021, 8:02 AMexpectSuccess = false
to the client's configuration. Also, SuccessResponse
and ErrorResponse
should implement the same interface MyCustomResponse
.