changed order of chain request

This commit is contained in:
Gouri Panda 2023-10-08 01:14:08 +05:30
parent 717d593ad3
commit 852deaf57b

View File

@ -71,13 +71,13 @@ fun ProductFlavor.fetchUrl(): String {
return url return url
.openConnection() .openConnection()
.apply { .apply {
connect()
if (urlString.isAuthenticationUrl){ if (urlString.isAuthenticationUrl){
setRequestProperty( setRequestProperty(
"Authorization", "Authorization",
"Basic ${Base64.getEncoder().encodeToString(System.getenv(secretKey).toByteArray())}" "Basic ${Base64.getEncoder().encodeToString(System.getenv(secretKey).toByteArray())}"
) )
} }
connect()
getInputStream() getInputStream()
}.let { }.let {
it.getHeaderField("Location")?.replace("https", "http") ?: it.url.toString() it.getHeaderField("Location")?.replace("https", "http") ?: it.url.toString()