I'm trying to write a middleware to accept CSP report from browser. Browser issues application/csp-report
as Content-Type
. The request being posted is JSON format. Currently I use bodyParser.text
to accept that Content-type. But I thought there might be a better way to accept application/csp-report
as JSON in bodyParser.
Here's what I'm doing right now.
app.use(bodyParser.json());
app.use(bodyParser.text({type: 'application/csp-report'}));
My question is how do I accept JSON request payload with Content-Type
application-csp-report
?