mirror of
/repos/Prototyper.git
synced 2025-12-30 06:31:32 +01:00
use express content-type helper
This commit is contained in:
parent
27dcb1ef8d
commit
dbf44bf06d
@ -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);
|
||||
};
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user