添加了urlencoded之后,出现以下错误,多了前面的[Object: null prototype]

问题
添加了urlencoded之后,出现以下错误,多了前面的[Object: null prototype]

解决方案
plan A:extended传为true, true/false代表使用解析的library不一样: qs/querystring

app.use(bodyParser.urlencoded({extended: true}))

plan B: 采用规避手段

if (req.body.__proto__ === undefined) {
  Object.setPrototypeOf(req.body, new Object());
}

plan C: 设置ajax的Content-Type: application/json; charset=utf-8, 同时需要设置app.use(bodyParser.json())
添加了urlencoded之后,出现以下错误,多了前面的[Object: null prototype]

上一篇:oracle查看执行计划explain plan FOR


下一篇:FirewallD is not running 远程服务器开启端口报错