bug: wrong spec for multiple files upload
giautm opened this issue · 2 comments
giautm commented
From spec: https://github.com/jaydenseric/graphql-multipart-request-spec#curl-request-1, map
should be valid JSON
{ "0": ["variables.files.0"], "1": ["variables.files.1"] }
But, the result from that line is
{ "0": ["variables.files.0"] }{ "1": ["variables.files.1"] }
giautm commented
const map: { [key: number]: string[] } = {}
if (uploadables.file) {
// single upload
map[0] = ['variables.file']
formData.append('0', uploadables.file)
} else {
// multi uploads
for (const i in uploadables.files) {
map[i] = [`variables.files.${i}`]
formData.append(i, uploadables.files[i])
}
}
formData.append('map', JSON.stringify(map))
config.body = formData