I am using ktor client in a mpp project and I am t...
# ktor
I am using ktor client in a mpp project and I am trying to post form-data:
Copy code
client.submitFormWithBinaryData {
    url { encodedPath = "my_url" }
    formData {
        append("my_key", "my_key_value")
Bu then get an error from kotlinx serialization:
kotlinx.serialization.SerializationException: Serializer for class 'MultiPartFormDataContent' is not found.
What am I missing here?
How is your client configured?
Copy code
val client = HttpClient {
        install(JsonFeature) {
            serializer = KotlinxSerializer(jsonConfig)

        install(DefaultRequest) {
            if (url.host == "localhost") {
                // Workaround to set a sort of a base url
                url.host = "my_host"
                url.protocol = URLProtocol.HTTPS
                url.encodedPath = "my_path" + url.encodedPath

        install(Logging) {
            logger = Logger.SIMPLE
            level = LogLevel.ALL
Anyone has a clue?
@cy i faced this problem too, please give us the cue
so I could be wrong, but I just manually set the form data my self:
Copy code
body = MultiPartFormDataContent( param.toFormData())
Note my toFormData() method is a custom extension for my usecase.
but that worked for me.
here’s my whole method:
Copy code
val response = client.submitForm<T> {                   contentType(ContentType.Application.Json)

                    method = <http://HttpMethod.Post|HttpMethod.Post>

                    if (param != null) {
                        if(param is JsonObject) body = MultiPartFormDataContent( param.toFormData())
Note I’m doing things in a kinda weird way with JsonObjects because I’m working towards migrating to a new API that will support JSON payloads, but currently my test/legacy API does not.
hope that helps