I'm trying to send a file to my api using this code
async function send(url, file) {
let formData = new FormData()
let stream = fs.createReadStream(file.path)
formData.append('file', stream, file.name)
try {
let response = await axios.post(url, formData, {
headers: {
... formData.getHeaders(),
Authentication: "Bearer ...",
})
} catch(err) {
// Do something
}
This code works when I run directly with node, for example, in the main process. But when I try to send this request from the electron browser, axios does not set the Content-Type header. Is important to mention that I also tried using ajax and the XMLHttpRequest, but its allways the same. This is what I get when sending it from electrin browser: Headers