connect-kotlin
connect-kotlin copied to clipboard
Recommendation for Tweaking/Retrying Requests in Interceptors
I'd like to do something similar to what I can do in an OkHttp interceptor, which is that if the response comes back with a token that is expired, for example, I can re-make the request. Today, the UnaryFunction's underlying lambda doesn't give me an easy way to re-try the request. Since the Interceptor is made per request, I can theoretically keep a reference to the HTTPRequest but don't have an obvious way to retry the request - theoretically i could pass in the ProtocolClient and call unary on it - but even this isn't ideal because it's tough to call the unary call given the templated types.
Is there a recommended way to do this? I see that the Swift sdk has something like this.