Open ikzsl opened 4 weeks ago
I have a similar issue in React Native but I use uri
with local system files so I added one more check:
[ContentType.FormData]: (input: any) =>
Object.keys(input || {}).reduce((formData, key) => {
const property = input[key]
if (Array.isArray(property) && property.every((p) => 'uri' in p)) {
property.forEach((p) => formData.append(key, p))
} else if (Array.isArray(property) && property.every((p) => p instanceof Blob)) {
property.forEach((p) => formData.append(key, p))
} else {
formData.append(
key,
property instanceof Blob ? property : typeof property === 'object' && property !== null ? JSON.stringify(property) : `${property}`,
)
}
return formData
}, new FormData()),
When I lost many time on non working multi file upload, I was surprised why it's not supported. Moreover, fix is trivial, something like
Originally posted by @darky in https://github.com/acacode/swagger-typescript-api/discussions/815#discussioncomment-10907960