简体   繁体   English

如何在nodejs中处理多部分/混合?

[英]How to handle multipart/mixed in nodejs?

I have been trying to read multipart/mixed data in nodejs.我一直在尝试读取 nodejs 中的多部分/混合数据。

I have tried using bodyparser , busboy-connect , and few other modules but nothing seems to parse this data into req.body .我尝试过使用bodyparser 、 busboy busboy-connect和其他几个模块,但似乎没有任何东西可以将这些数据解析为req.body

So if someone has any idea about how to implement this please leave an answer below.因此,如果有人对如何实现这一点有任何想法,请在下面留下答案。 Thank you.谢谢你。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM