无法parsing快速编码的url数据

我有这个超级简单的服务器:

var app = require('express')(); var bodyParser = require('body-parser'); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); app.post('/update', (req, resp) => { debugger; resp.send(); }); var server = app.listen(3000, function () { var host = server.address().address; var port = server.address().port; console.log('Example app listening at http://%s:%s', host, port); }); 

使用邮递员 ,我发送数据到服务器是这样的:

邮差截图

收到请求时,REPL显示一个空的正文:

 > req.body {} 

我希望身体看起来像这样:

 { "hello": "world" } 

我错过了什么明显的? 可能..

通过在邮递员下面selectx-form-urlencoded将为您发送Content-Type标题,您不需要再次指定它自己。 你可以通过点击预览button来看到。 所以你发送一个重复的Content-Type头,这似乎是绊倒身体分析器。