Hey all. I have my `AndroidEngineConfig` set up in...
# ktor
s
Hey all. I have my
AndroidEngineConfig
set up in a way that if the method isn't
GET
,
HEAD
or
DELETE
to set the content type to
ContentType.Application.Json
. This is fine for all of my
POST
requests with bodies, but I now need to make a
POST
request without a body (it is only a path with an Empty response), and I am getting:
Copy code
io.ktor.http.UnsafeHeaderException: Header Content-Type is controlled by the engine and cannot be set explicitly
Is there any way I can override the
Content-Type
for this single request, or is there a way I can programmatically set it for each individual request?
I was thinking of making a second engine for content-types that aren't Json but I don't know if that's overkill
r
Can’t you just set the content type in the request builder?
e
Hi @Shan, sorry for the long delay. You can set content type header in
OutgoingContent
body.
s
ooh, thank you!