I have an api that I'm testing at the moment. I'm using
ngrok to make my local server that has the api code visible to the internet. If, for example, I have a link like
http://something.ngrok.io/api/spreadsheet?param1=123¶m2=001,002, what should happen when you click on that link is a spreadsheet is dynamically built using
exceljs and sent to the client using express. Here is that snippet of code:
const buffer = await workbook.xlsx.writeBuffer() res.status(200) res.set("Content-Type", "application/octet-stream") res.attachment("spreadsheet.xlsx") res.send(buffer)
The weird thing that I can't figure out is when you just copy and paste that
ngrok link into your browser it prompts the spreadsheet download as I hoped would happen. When you send someone that link through an email client and try to click it, it opens a new tab like it's going to prompt the download, but after a second or two the tab just closes and nothing else happens. Is this because of some email client security? Is there a way to allow the download?