I'm trying to retrieve a csv template that is in an API response. I am getting a 200 status and I can see the response data in the network tab of Chrome Dev tools. The response text is supposed to be the column headers in the csv file. But how do I actually get the csv file to either download or open in excel?
return request
.get(url)
.set('Content-Type', 'text/csv')
.end(function (err, res) {
if (res) {
// get csv template?
}
});
response looks like:
statusCode: 200
content-disposition: attachment; filename="template.csv"
header: {content-length: "100", content-type: "text/csv"}
type: text/csv
text: "First Name","Last Name","Email"