I'm getting the warning "This API is internal in k...
# ktor
j
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
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
Thank you! Good to know.