0

here is a simple questions:

I need to export an array into csv and send it as a file response using restify. Following implementation, obviously not working

var result = fileUploadSvc.exportCSVData(data);
    res.writeHead(200, {
        'Content-Type': 'text/csv',
        'Content-Disposition': 'attachment; filename=export.csv'
    });

    res.end(result);

Where result - is a transformed csv string. What am I doing wrong? More to say: When I set 'accept' header - as 'text/csv' on the front-end - there result I get is: 406 HTTP Error. And the log tells me that response still came as 'application/json'

SkSirius
  • 156
  • 1
  • 9

1 Answers1

0

Resolved that one. Worked fine. The issue was on processing file download in angular

SkSirius
  • 156
  • 1
  • 9