From 730cbb82d3303466b10e8aa687a36863527a3e1b Mon Sep 17 00:00:00 2001 From: Artem Yelizarov Date: Fri, 29 Mar 2024 12:19:06 +0200 Subject: [PATCH] [SE-810] Add token only when it's not blank --- .../main/java/com/streamamg/api/player/PlayBackAPIService.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/playback-sdk-android/src/main/java/com/streamamg/api/player/PlayBackAPIService.kt b/playback-sdk-android/src/main/java/com/streamamg/api/player/PlayBackAPIService.kt index 26bb4bf..02de726 100644 --- a/playback-sdk-android/src/main/java/com/streamamg/api/player/PlayBackAPIService.kt +++ b/playback-sdk-android/src/main/java/com/streamamg/api/player/PlayBackAPIService.kt @@ -48,7 +48,9 @@ internal class PlayBackAPIService(private val apiKey: String) : PlayBackAPI { try { setRequestProperty("Accept", "application/json") setRequestProperty("x-api-key", apiKey) - authorizationToken?.let { setRequestProperty("Authorization", "Bearer $it") } + if (!authorizationToken.isNullOrBlank()) { + setRequestProperty("Authorization", "Bearer $authorizationToken") + } val responseText = if (responseCode == HttpURLConnection.HTTP_OK) { inputStream.bufferedReader().use(BufferedReader::readText)