My method for creating a FormData object
function generateFormData(file, payload) {
let formData = new window.FormData()
formData.append('Excel', file)
formData.append('SomeOtherKey', JSON.stringify(payload))
return formData
}
My approach for transmitting data to the server
function transmitDataToServer(payload) {
axios.post('/some-url', payload)
}
Although in the request body it is currently set as application/octet-stream
, I require it to be
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Snapshot of the request payload
https://i.sstatic.net/JQSVf.png
How can I accurately specify the Content-Type
for the file?