mirror of
/repos/Prototyper.git
synced 2026-06-25 12:30:50 +02:00
use express content-type helper
This commit is contained in:
+7
-2
@@ -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);
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user