1
0
mirror of /repos/Prototyper.git synced 2025-12-30 06:31:32 +01:00

use express content-type helper

This commit is contained in:
Aiko Mastboom 2014-12-30 13:51:07 +01:00
parent 27dcb1ef8d
commit dbf44bf06d

View File

@ -17,8 +17,13 @@ module.exports = function (options, res, next) {
if (options.attribute) {
content = result[options.attribute];
}
// Set _Content-Type_ response header with `type` through `mime.lookup()`
res.type(options.ext);
if (options.ext) {
// Set _Content-Type_ response header with `type` through `mime.lookup()`
res.type(options.ext);
} else {
res.type('text/plain');
}
return res.send(content);
};
};