我希望通过nodejs解析"Multipart/mlixed“内容,我尝试使用以下代码,但是req.body始终是空的:
var express = require('express');
var bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({ extended: true }));
var app = express();
app.post('/documents/videoCollect', function(req, res, nexr){
console.log(req.body);
res.send(req.body);
});
下面是一个多部分/混合内容的示例:
'content-type': 'multipart/mixed; boundary="----=_XXXXXXX"'
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<test>
<name>testName</name>
</test>
您知道这是否有解析器模块,或者我是如何做到的?我尝试过使用body解析器、body解析器-xml和强大的,而req.body总是为空。
发布于 2017-03-29 09:08:33
身体解析器不处理多部分的身体,因为它们的复杂和典型的大性质。对于多部分主体,您可能对以下模块感兴趣:
该模块提供以下解析器:
https://stackoverflow.com/questions/38221104
复制相似问题