-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed as not planned
Closed as not planned
Copy link
Labels
status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently applytheme: kotlinAn issue related to Kotlin supportAn issue related to Kotlin support
Description
Affects: 6.1.12
Hi all,
I'm using spring-web in Kotlin as a REST client and I encountered some issues when trying to serialize a MutableList
I prepared a sample code to show the issue:
fun main() {
val client = RestTemplate(listOf(
KotlinSerializationJsonHttpMessageConverter()
))
val data = mutableListOf<String>()
data.add("1")
data.add("2")
val entity = HttpEntity(data, HttpHeaders().apply {
contentType = MediaType.APPLICATION_JSON
})
val response = client.exchange("https://httpbin.org/post", HttpMethod.POST, entity, String::class.java)
logger.info(response.body)
}But when I run this code, I get this error:
No HttpMessageConverter for java.util.ArrayList and content type "application/json"
I assumed KotlinSerializationJsonHttpMessageConverter Would be able to convert this to ["1", "2"], but it doesn't seem to work
Metadata
Metadata
Assignees
Labels
status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently applytheme: kotlinAn issue related to Kotlin supportAn issue related to Kotlin support