Skip to content

Instantly share code, notes, and snippets.

@Unlimity
Created April 9, 2019 07:43
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 Unlimity/b6d9f139b650b267ae1378a0c03203f9 to your computer and use it in GitHub Desktop.
Save Unlimity/b6d9f139b650b267ae1378a0c03203f9 to your computer and use it in GitHub Desktop.
val client = NinjatoOkHttpClient(okHttpClient) {
retryPolicy = MyRetryPolicy()
fallbackPolicy = MyFallbackPolicy()
retryPolicy { request, throwable ->
if (request.retries > 3) Retry.DoNotRetry else Retry.WithoutDelay
}
fallbackPolicy { request, throwable ->
request.also { it.baseUrl = "https://anotherServer.com" }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment