https://kotlinlang.org logo
#android
Title
# android
m

morozov

08/19/2019, 3:14 PM
any ideas someone?) or unclear?)
l

Luca Nicoletti

08/19/2019, 3:21 PM
Does
API_AUTHORIZATIONS
equals to
api/mandarine/v1/authorizations
?
And what are you getting, can we see expected/was
?
m

morozov

08/19/2019, 3:24 PM
yep
api/mandarine/v1/authorizations
myroute
clipped
i don t understand why)
l

Luca Nicoletti

08/19/2019, 3:37 PM
Well, you’re not using the baseUri at all
I mean, you’re building a Uri with authority =
<http://google.com|google.com>
, scheme =
https
and appending the path
the
/myroute
does not belong to authority and you’re not setting it anywhere
m

morozov

08/19/2019, 4:13 PM
i wrote smth like this:
Copy code
internal fun createRequestUrl(baseUrl: String, vararg routePaths: String): String {
    val baseUri = Uri.parse(baseUrl)
    Log.d("some", "baseUri: $baseUri")
    val builder = Uri.Builder()
        .scheme(baseUri.scheme ?: "https")
        .encodedAuthority(baseUri.authority ?: "")
    routePaths.forEach { builder.appendEncodedPath(it) }
    return builder.build().toString()
}
now checking
l

Luca Nicoletti

08/19/2019, 4:17 PM
It should work as long as you’ll pass the list of paths you need, but you could also add
/myroute
to your
API_AUTHORIZATIONS
Or create a new cosnt val with it
m

morozov

08/19/2019, 6:04 PM
I may not have it and every time it changes