Wednesday 24 July 2019

Override app.use middleware

So our application uses app.use(bodyParser.json()). For one of my post methods I want to actually get the RAW body. Is there a way to override one function to parse using raw? Or would I have to get rid of the app.use and define each method individually to use JSON or RAW?Current method is configured as:app.post('/myhook', bodyParser.raw({type: 'application/json'}), (request, response) => {This still gets a JSON body, presumably because the JSON parser middleware has already processed it.

Submitted July 25, 2019 at 03:16AM by pushc6

No comments:

Post a Comment