for some reason posting an audio file as multipart/form-data doesn’t work the payload shows up as [object object]. below is a snippet where i get a signed url from google storage then post the form data to it, everything works but the request body is just [object object] instead of form data.
const data = new FormData()
const meta = {
uri, // "file://dsfsdfd/sfsfsd.caf"
name: 'something.caf',
type: 'audio/caf',
}
console.log(meta)
data.append('file', meta)
console.log('data pre send', data)
try {
const response = await fetch(`${signed_url}`, {
body: data,
method: 'PUT',
headers: {
'Content-Type': 'multipart/form-data',
},
})
console.log('upload', response) // success
} catch (e) {
console.log('no upload', response)
}
}
postImageToServer = (ticketId, params) => {
return axios
.post(`/tickets/${ticketId}/imageUpload`, params)
.then(response => response.data, () => (this.state = 'error'))
}
}