lenqnr
07/01/2019, 6:01 AM<http://client.post|client.post><String>("/path", "hello")
I get double-quoted data on both sides.
println(call.receiveText())
// Result: "hello"
What is the proper way to handle this?cy
07/01/2019, 4:14 PMlenqnr
07/01/2019, 11:43 PMe5l
07/02/2019, 7:46 AMlenqnr
07/02/2019, 1:50 PMfun main() = runBlocking {
val httpClient = HttpClient(CIO) {
install(JsonFeature) {
serializer = GsonSerializer()
}
}
<http://httpClient.post|httpClient.post><Unit> {
url("<http://localhost:8080>")
contentType(ContentType.Application.Json)
body = "hello"
}
}
I made a function for the post
with a parameter for the body
values and sent a String value with "Content-Type: application/json". I gotta add a parameter contentType
or make another function for primitive types.