0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 16:22:44 +00:00
Files
homebrewery/server/middleware/content-negotiation.js
2023-01-21 00:48:41 -06:00

12 lines
309 B
JavaScript

module.exports = (req, res, next)=>{
const isImageRequest = req.get('Accept').split(',')
.filter((h)=>!h.includes('q='))
.every((h)=>/image\/.*/.test(h));
if(isImageRequest) {
return res.status(406).send({
message : 'Request for image at this URL is not supported'
});
}
next();
};