Maverick101101
Maverick101101

Reputation: 1

How to handle multipart/mixed in nodejs?

I have been trying to read multipart/mixed data in nodejs.

I have tried using bodyparser, busboy-connect, and few other modules but nothing seems to parse this data into req.body.

So if someone has any idea about how to implement this please leave an answer below. Thank you.

Upvotes: 0

Views: 429

Answers (1)

Maverick101101
Maverick101101

Reputation: 1

app.use(myMiddleware);
 function myMiddleware(req, res, next) {
     req.rawBody = req.body;
     if (req.headers["content-type"] === "multipart/mixed") {
         req.body = req.body;
     }
     next();
}

Upvotes: -1

Related Questions