log-headers

This commit is contained in:
google-labs-jules[bot] 2025-08-29 14:04:56 +00:00
parent b9f353bb5a
commit 7dd9185171

View file

@ -1,6 +1,7 @@
package fr.free.nrw.commons package fr.free.nrw.commons
import androidx.annotation.VisibleForTesting import androidx.annotation.VisibleForTesting
import fr.free.nrw.commons.BuildConfig
import fr.free.nrw.commons.wikidata.cookies.CommonsCookieJar import fr.free.nrw.commons.wikidata.cookies.CommonsCookieJar
import okhttp3.Cache import okhttp3.Cache
import okhttp3.Interceptor import okhttp3.Interceptor
@ -40,9 +41,13 @@ object OkHttpConnectionFactory {
.writeTimeout(120, TimeUnit.SECONDS) .writeTimeout(120, TimeUnit.SECONDS)
.readTimeout(120, TimeUnit.SECONDS) .readTimeout(120, TimeUnit.SECONDS)
.addInterceptor(HttpLoggingInterceptor().apply { .addInterceptor(HttpLoggingInterceptor().apply {
if (BuildConfig.DEBUG) {
setLevel(HttpLoggingInterceptor.Level.BODY)
} else {
setLevel(HttpLoggingInterceptor.Level.BASIC) setLevel(HttpLoggingInterceptor.Level.BASIC)
redactHeader("Authorization") redactHeader("Authorization")
redactHeader("Cookie") redactHeader("Cookie")
}
}) })
.addInterceptor(UnsuccessfulResponseInterceptor()) .addInterceptor(UnsuccessfulResponseInterceptor())
.addInterceptor(CommonHeaderRequestInterceptor()) .addInterceptor(CommonHeaderRequestInterceptor())