https://kotlinlang.org logo
Title
j

jeggy

03/17/2021, 5:14 PM
How can I do a request like this using the ktor client?
curl --request POST --form "field=value" <http://localhost:8080>
I have tried looking at
submitForm
but when using this it just gives this error:
Serializer for class 'FormDataContent' is not found.
p

Paul Griffith

03/17/2021, 6:04 PM
I don't know why
submitForm
doesn't work, but you can manually wrap the body in
MultiPartFormDataContent
and it seems to work
j

jeggy

03/17/2021, 7:26 PM
Gives the same issue
Serializer for class 'MultiPartFormDataContent' is not found.
Sorry, found my mistake. I had this in my client configuration:
header(HttpHeaders.ContentType, ContentType.Application.Json)
👍 1