Hello everyone, I'm new to the ktor client and I d...
# ktor
l
Hello everyone, I'm new to the ktor client and I don't know how to inject a dynamic value into the header, this is my actual code, it's not working because I need to call a suspend function
Copy code
install(DefaultRequest) {
    // Before making the request, get the session
    val session = localPreferences.getSession()

    // Modify the request to include the token in the headers
    session?.let {
        headers.append("Access-Token", it.token)
        headers.append("Client", it.client)
        headers.append("Uid", it.user.uid)
    }
}
a
Docs should have what you're looking for here
a
Unfortunately, the only way at the moment is to block the thread with
runBlocking
. Feel free to follow this feature request for updates.