Ktorfit icon indicating copy to clipboard operation
Ktorfit copied to clipboard

String Values body values differ, based on list quantity

Open ferenczAndras opened this issue 4 months ago • 0 comments

Ktorfit version

1.12.0

What happened and how can we reproduce this issue?

I have the following POST request:

        val groups: StringValues = StringValuesSingleImpl(
            caseInsensitiveName = false,
            name = "groupIds",
            values = groupIds
        )

        val bodyParameters = Parameters.build {
            appendAll(groups)
        }

        val result = provider.eventApi.addGroups(
            eventId = eventId,
            authToken = authHeader.value,
            body = FormDataContent(bodyParameters)
        )

And the server receives the following values:

{"level":"info","message":"{\"groupIds\":\"65a568af4227db35f2969637\"}","service":"user-service"}
{"level":"info","message":"{\"groupIds\":[\"65be567a3055e32db9a6eff8\",\"65be550a3055e32db9a6eff4\"]}","service":"user-service"}

The first version contains only one ID, while the second two.

I am missing something?

What did you expect to happen?

To have the same format.

Is there anything else we need to know about?

No response

ferenczAndras avatar Feb 21 '24 08:02 ferenczAndras