removed default jpg content type and added missing content type error

This commit is contained in:
bill bittner 2018-07-07 15:03:21 -07:00
parent 5f486e3d50
commit 6fe04b13ce

View file

@ -1,13 +1,16 @@
const logger = require('winston');
const serveFile = ({ filePath, fileType }, res) => {
logger.verbose(`serving file: ${filePath}`);
if (!fileType) {
logger.error(`no fileType provided for ${filePath}`);
}
const sendFileOptions = {
headers: {
'X-Content-Type-Options': 'nosniff',
'Content-Type' : fileType || 'image/jpeg',
'Content-Type' : fileType,
},
};
logger.debug(`fileOptions for ${filePath}:`, sendFileOptions);
res.status(200).sendFile(filePath, sendFileOptions);
};