Casey Brooks
11/22/2019, 7:58 PMmattway
11/23/2019, 9:43 AMPete
11/24/2019, 9:13 AMcall.receiveParameters()
to get what is basically a Map<String, List<String>>
to work with. This doesn't automatically parse into models like the JSON converters.
To use the syntax of call.receive<MyDataModel>()
with x-www-form-urlencoded
we need to use the ContentNegotiation
feature and write our own converter to do the mapping:
install(ContentNegotiation) {
register(ContentType.Application.FormUrlEncoded, FormUrlEncodedConverterThatNeedsWriting())
}
I'm knew to Kotlin so I haven't managed to write a converter to handle form data in the same way as something like Ruby on Rails does using [ ]
as delimiters.
I've made this gist from the JacksonConverterTest incase someone is able to help: https://gist.github.com/createdbypete/ac57c6b59133b184799fadbf32b4b93a