com.chimerapps.gradle.transifex.utils.ApiTokenAuthInterceptor.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of transifex-plugin Show documentation
Show all versions of transifex-plugin Show documentation
Gradle plugin that allows translations to be downloaded from transifex
The newest version!
package com.chimerapps.gradle.transifex.utils
import okhttp3.Credentials
import okhttp3.Interceptor
import okhttp3.Response
/**
* @author Nicola Verbeeck
* @date 18/09/2017.
*/
class ApiTokenAuthInterceptor : Interceptor {
var apiToken: String = ""
override fun intercept(chain: Interceptor.Chain): Response {
val request = chain.request()
val authenticatedRequest = request.newBuilder()
.header("Authorization", Credentials.basic("api", apiToken)).build()
return chain.proceed(authenticatedRequest)
}
}