Skip to content

Instantly share code, notes, and snippets.

@lordcodes
Created March 17, 2020 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lordcodes/adb4986bb23f7cc0ef928c8f511ea689 to your computer and use it in GitHub Desktop.
Save lordcodes/adb4986bb23f7cc0ef928c8f511ea689 to your computer and use it in GitHub Desktop.
Code for the article: "Authorization and retrying of web requests for OkHttp and Retrofit"
private val Response.retryCount: Int
get() {
var currentResponse = priorResponse
var result = 0
while (currentResponse != null) {
result++
currentResponse = currentResponse.priorResponse
}
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment