On the server I have something like:
WebApp.connectHandlers.use('/export', (req, res, next) => {
...
fs.readFile(file, (err, buf) => {
...
res.writeHead(200, {
'Content-Type': 'application/octet-stream',
'Content-Disposition': `attachment; filename="data.xlsx"`
});
res.end(buf);
});
}
On the client, when downloading the file, I get a warning:
Resource interpreted as Document but transferred with MIME type application/octet-stream
Checking the response headers in the chrome devtools network tab, I noticed that the content-type header is set to text/html; charset=utf-8
. Why is that?