Hello! How to retry request in `HttpClientFeature`...
# ktor
a
Hello! How to retry request in
HttpClientFeature
after
Exception
? Now, I have next code:
Copy code
override fun install(feature: ExceptionFeature, scope: HttpClient) {
            scope.sendPipeline.intercept(HttpSendPipeline.Before) {
                for (counter in 0..2) {
                    try {
                        proceed()
                        break
                    } catch (e: IOException) {
                        println("IO Error :$counter")
                        if (counter == 2) {
                            throw e
                        }
                    }
                }
            }
e
Hey, you can use
HttpSend
feature for that. It allows you to repeat the request(as in HttpRedirect feature)
1
a
@e5l I'm sorry for my mistake, maybe you don't understand my problem. I need retry request after exception (example micro problems with connection). If I will haven't connection program throw exception in here and it don't gone to interceptors. I could be wrong.