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

Hamza

07/24/2019, 11:05 AM
POST <http://localhost:1296/search> 415 (Unsupported Media Type)
m

mbonnin

07/24/2019, 11:06 AM
Copy code
install(JsonFeature) {
            serializer = KotlinxSerializer(Json.nonstrict).apply {
                setMapper(YourClass::class, ClaimInput.serializer())
            }
        }
?
Ah, you might also need
contentType(ContentType.Application.Json)
Copy code
<http://client.post|client.post>("<http://localhost:1296/search>") {
        body = postData
        contentType(ContentType.Application.Json)
    }
h

Hamza

07/24/2019, 11:13 AM
@mbonnin i mean my server post accept json
m

mbonnin

07/24/2019, 11:13 AM
Ah, server side sorry I haven't used that part yet
h

Hamza

07/24/2019, 11:14 AM
all good.
h

Hamza

07/24/2019, 11:57 AM
@cy i thought about looking more into CN right as you sent it hahaha. I just learnt that it can also be used to parse requests. Thank you for responding! Much appreciated
47 Views