improve UserAgent

This commit is contained in:
Konrad Pozniak 2020-10-02 19:36:40 +02:00
parent 75eea7d614
commit ca7fdda124
1 changed files with 2 additions and 1 deletions

View File

@ -22,6 +22,7 @@ package at.connyduck.pixelcat.network
import android.os.Build
import at.connyduck.pixelcat.BuildConfig
import okhttp3.Interceptor
import okhttp3.OkHttp
import okhttp3.Response
class UserAgentInterceptor : Interceptor {
@ -29,7 +30,7 @@ class UserAgentInterceptor : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
val requestWithUserAgent = chain.request()
.newBuilder()
.header("User-Agent", "PixelCat/${BuildConfig.VERSION_NAME} Android/${Build.VERSION.RELEASE}")
.header("User-Agent", "Pixelcat/${BuildConfig.VERSION_NAME} Android/${Build.VERSION.RELEASE} okhttp/${OkHttp.VERSION}")
.build()
return chain.proceed(requestWithUserAgent)
}