Why only `headers.append` have a method with `Head...
# ktor
m
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
In the
append(name: String, value: HeaderValueWithParameters)
the
append(name, value.toString())
is called so you can use the
toString
method in your code:
Copy 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
Thanks Aleksei, was just wondering whether this was intentional. Please fix the linked doc then.
a
I’ve created an issue to address the problem with a compilation error.