Skip to content

Commit a1ddcb3

Browse files
committed
Merge pull request #66 from kalebscholes/master
Set correct Content-Type header for json and xml
2 parents 3dad58a + f497da3 commit a1ddcb3

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

routes/api.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,14 @@ function genUser(req, res, version) {
5959
res.setHeader('Content-disposition', 'attachment; filename=download.' + ext);
6060
fs.writeFileSync(name, output, 'utf8');
6161
} else {
62-
res.setHeader('Content-Type', 'text/plain');
62+
63+
if (ext === 'json'){
64+
res.setHeader('Content-Type', 'application/json');
65+
}else if (ext === 'xml'){
66+
res.setHeader('Content-Type', 'text/xml');
67+
}else{
68+
res.setHeader('Content-Type', 'text/plain');
69+
}
6370
}
6471

6572
var payload = {

0 commit comments

Comments
 (0)