[kotlin-multiplatform] Fixed build error when setting formdata in array (#16329)

This commit is contained in:
YusukeOba
2023-08-15 22:07:10 +09:00
committed by GitHub
parent 2e17653ae8
commit c3c0188bf4
2 changed files with 10 additions and 1 deletions

View File

@@ -66,7 +66,14 @@ import kotlinx.serialization.encoding.*
{{#isMultipart}} {{#isMultipart}}
formData { formData {
{{#formParams}} {{#formParams}}
{{#isArray}}
{{{paramName}}}?.onEach {
append("{{{baseName}}}[]", it)
}
{{/isArray}}
{{^isArray}}
{{{paramName}}}?.apply { append("{{{baseName}}}", {{{paramName}}}) } {{{paramName}}}?.apply { append("{{{baseName}}}", {{{paramName}}}) }
{{/isArray}}
{{/formParams}} {{/formParams}}
} }
{{/isMultipart}} {{/isMultipart}}

View File

@@ -81,7 +81,9 @@ open class DefaultApi(
fn1?.apply { append("fn1", fn1) } fn1?.apply { append("fn1", fn1) }
fn2?.apply { append("fn2", fn2) } fn2?.apply { append("fn2", fn2) }
fn3?.apply { append("fn3", fn3) } fn3?.apply { append("fn3", fn3) }
fn4?.apply { append("fn4", fn4) } fn4?.onEach {
append("fn4[]", it)
}
} }
val localVariableQuery = mutableMapOf<String, List<String>>() val localVariableQuery = mutableMapOf<String, List<String>>()