客户端代码:
var xhr = new XMLHttpRequest();
xhr.open('POST', '/frame', true);
xhr.send(blob);
服务器代码:
app.use(bodyParser.urlencoded({extended: false,limit: '50mb'}));
app.post('/frame', function (req, resp) {
console.log(req.body);
});
这会导致 PayloadTooLargeError 错误:参数过多。添加的内容是:
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');
解决问题的方法不止这一种。还有其他想法吗?