mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
log-headers
This commit is contained in:
parent
b9f353bb5a
commit
7dd9185171
1 changed files with 8 additions and 3 deletions
|
|
@ -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 {
|
||||||
setLevel(HttpLoggingInterceptor.Level.BASIC)
|
if (BuildConfig.DEBUG) {
|
||||||
redactHeader("Authorization")
|
setLevel(HttpLoggingInterceptor.Level.BODY)
|
||||||
redactHeader("Cookie")
|
} else {
|
||||||
|
setLevel(HttpLoggingInterceptor.Level.BASIC)
|
||||||
|
redactHeader("Authorization")
|
||||||
|
redactHeader("Cookie")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.addInterceptor(UnsuccessfulResponseInterceptor())
|
.addInterceptor(UnsuccessfulResponseInterceptor())
|
||||||
.addInterceptor(CommonHeaderRequestInterceptor())
|
.addInterceptor(CommonHeaderRequestInterceptor())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue