[kotlin][client] only use authentication tokens when they are not null (#4238)

* [kotlin-client] only use authentication tokens when they are not null

* [kotlin-client] only use authentication tokens when they are not null
This commit is contained in:
Bruno Coelho
2019-10-23 17:46:46 +01:00
committed by William Cheng
parent fbf3d593df
commit 620aa4fd5e
10 changed files with 52 additions and 14 deletions

View File

@@ -83,7 +83,9 @@ open class ApiClient(val baseUrl: String) {
}
}
if (requestConfig.headers[Authorization].isNullOrEmpty()) {
requestConfig.headers[Authorization] = "Bearer " + accessToken
accessToken?.let { accessToken ->
requestConfig.headers[Authorization] = "Bearer " + accessToken
}
}
}