https://kotlinlang.org logo
Title
t

tseisel

07/08/2019, 10:16 AM
Is there a way to automatically retry a request given a specific response (for example, HTTP 421) with HttpClient ?
v

voben

07/08/2019, 9:46 PM
Using the okhttp client you can intercept the response, check the code. If code == 421. Make request again.
t

tseisel

07/09/2019, 6:45 AM
I've had a look at interceptors for HttpClient :
requestPipeline
and
responsePipeline
. The problem is, which phase should I intercept ? How to re-issue a request with the same pipeline as the original ? It seems that when calling
httpClient.execute(...)
, it loses the ability to deserialize Json.