Skip to content

Instantly share code, notes, and snippets.

@lordcodes
Created March 17, 2020 09:32
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/3361b20c5fecf82d2c74372d8a1db245 to your computer and use it in GitHub Desktop.
Save lordcodes/3361b20c5fecf82d2c74372d8a1db245 to your computer and use it in GitHub Desktop.
Code for the article: "Authorization and retrying of web requests for OkHttp and Retrofit"
enum class AuthorizationType {
ACCESS_TOKEN,
CLIENT_CREDENTIALS,
NONE;
companion object {
fun fromRequest(request: Request): AuthorizationType =
request.tag(AuthorizationType::class.java) ?: ACCESS_TOKEN
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment