From 8cc12fb8d4e09e24bbf085f7e9b97c82b21f6293 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 3 Aug 2020 15:06:15 +0200 Subject: [PATCH] Only one token per request is possible so use `header` instead of `addHeader` --- .../android/internal/network/AccessTokenInterceptor.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/network/AccessTokenInterceptor.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/network/AccessTokenInterceptor.kt index a15f660790..4646cb2fca 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/network/AccessTokenInterceptor.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/network/AccessTokenInterceptor.kt @@ -25,10 +25,10 @@ internal class AccessTokenInterceptor(private val accessTokenProvider: AccessTok override fun intercept(chain: Interceptor.Chain): Response { var request = chain.request() - accessTokenProvider.getToken()?.let { + // Add the access token to all requests if it is set + accessTokenProvider.getToken()?.let { token -> val newRequestBuilder = request.newBuilder() - // Add the access token to all requests if it is set - newRequestBuilder.addHeader(HttpHeaders.Authorization, "Bearer $it") + newRequestBuilder.header(HttpHeaders.Authorization, "Bearer $token") request = newRequestBuilder.build() }