I\'m trying to write a middleware to accept CSP report from browser. Browser issues application/csp-report
as Content-Type
. The request being poste
In addition to @Barry's answer, you can set endpoint path more specifically:
app.use('/report-violation', bodyParser.json({ type: 'application/json' }));
app.use('/report-violation', bodyParser.json({ type: 'application/csp-report' }));
app.use('/report-violation', (req, res) => {
// handle req.body
});