anybody have a way to work around the above ^. I'...
# ktor
c
anybody have a way to work around the above ^. I'm a bit confused about the error
ktor Content-Type need to be passed in OutgoingContent.contentType
. Anybody have links to OutgoingContent documentation and how I can configure it at instantiation?
z
there's also a contentType method on HttpMessageBuilder. Would that work for you?
Copy code
client.get<HttpResponse>() {
    contentType(ContentType.Application.Json)
    //...
}
it's just weird because GET doesn't have a body...
c
referencing it in the messagebuilder has always given me the initial runtime error of
io.ktor.http.UnsafeHeaderException: Header Content-Type is controlled by the engine and cannot be set explicitly
z
probably because you're trying to set it on a GET request. Are you sure you're not confusing Content-Type with Accept?
c
probably. i have an api i'm interacting with that I initially set headers for all requests :X
thanks ­čÖé
r
I spun around in circles on that recently for a while before I realized I was trying to add it to all requests and I didn't need it on my GET.