https://kotlinlang.org logo
#ktor
Title
# ktor
j

Jeff Lockhart

09/15/2021, 6:50 PM
I'm getting the warning "This API is internal in ktor and should not be used. It could be removed or changed without notice." using the
append()
or
appendAll()
functions to add headers to a request. For example, the example in the documentation:
Copy code
val response: HttpResponse = client.get("<https://ktor.io/>") {
    headers {
        append(HttpHeaders.Accept, "text/html") // warning
        append(HttpHeaders.Authorization, "token") // warning
        append(HttpHeaders.UserAgent, "ktor client") // warning
    }
}
Is there a new pattern that should be used for this? Why is
StringValuesBuilder
marked
@InternalAPI
now? Using ktor 1.6.3.
r

Rustam Siniukov

09/15/2021, 7:00 PM
It is safe to use this API. You can use
@OptIn
annotation to remove the warning. Will be fixed in 2.0.0 See more details here https://youtrack.jetbrains.com/issue/KTOR-3001
j

Jeff Lockhart

09/15/2021, 7:12 PM
Thank you! Good to know.
5 Views