https://kotlinlang.org logo
#ktor
Title
# ktor
m

mytrile

12/04/2020, 8:25 PM
Hi, I'm trying out ktor and reading the HTTP API—Ktor 1.4.0, but when I make post request it gives me Caused by: io.ktor.features.CannotTransformContentToTypeException: Cannot transform this request's content to com.example.LoginRegister
r

Rafal

12/05/2020, 2:04 PM
Looks like you dont have any ContentNegotiation feature installed
I prefer to use
kotlinx.serialization
as a
ContentNegotiation
feature
m

mytrile

12/06/2020, 10:16 AM
Thanks for the reply, if I use ContentNegotiation with serialization and make request the response is 415 Unsupported Media Type
So if I use jackson and make a request with JSON body everything works
r

Rafal

12/07/2020, 11:39 AM
check if setting
Content-Type:application/json
to your request solves the issue
5 Views