This seems like it should be a fairly simple question, but I\'m having a really hard time figuring out how to approach it.
I\'m using Node.js + Express to build a we
With express v4, and body-parser v1.17 and above,
You can pass a function in the type
of bodyParser.json.
body-parser will parse only those inputs where this function returns a truthy value.
app.use(bodyParser.json({
type: function(req) {
return req.get('content-type').indexOf('multipart/form-data') !== 0;
},
}));
In the above code,
the function returns a falsy value if the content-type
is multipart/form-data
.
So, it does not parse the data when the content-type
is multipart/form-data
.