https://kotlinlang.org logo
Title
m

MJegorovas

04/28/2022, 11:01 AM
Why only
headers.append
have a method with
HeaderValueWithParameters
as second parameter and other
append*
don't? If only
append
should have this, then this doc needs to be fixed: https://api.ktor.io/ktor-client/ktor-client-core/io.ktor.client.plugins/-default-request/index.html (see "usage" box).
a

Aleksei Tirman [JB]

04/28/2022, 11:15 AM
In the
append(name: String, value: HeaderValueWithParameters)
the
append(name, value.toString())
is called so you can use the
toString
method in your code:
val headers = HeadersBuilder()
headers.append("", ContentType("application", "json"))
headers.appendIfNameAbsent("", ContentType("application", "json").toString())
Feel free to file a feature request if you think that having those overloads is necessary in Ktor.
m

MJegorovas

04/28/2022, 11:17 AM
Thanks Aleksei, was just wondering whether this was intentional. Please fix the linked doc then.
a

Aleksei Tirman [JB]

04/28/2022, 11:39 AM
I’ve created an issue to address the problem with a compilation error.