Hi guys I am trying to get ktor http client to POS...
# ktor
w
Hi guys I am trying to get ktor http client to POST a request to an API with FormURLEncoded. I am getting the following error: io.ktor.http.UnsafeHeaderException: Header Content-Type is controlled by the engine and cannot be set explicitly Here is my data class: data class getAuth( val client_id: String, val client_secret: String, val grant_type: String = "client_credentials", val scope: String = "NSMS" ) Here is my constructor: val message = client.post<Unit> { url(URL("https://tapi.telstra.com/v2/oauth/token")) contentType(ContentType.Application.FormUrlEncoded) body = getAuth(client_id = "overriddenkey", client_secret = "overridenpass") } Is there something I am missing here? How do I go about sending the POST with Content-Type: application/x-www-form-urlencoded ?
👀 1
e
Hi @wilyarti. Could you file an issue?
w
Yes certainly. I will double check it tomorrow and file an issue.