I am using nodejs + Express (v3) like this:
app.use(express.bodyParser());
app.route(\'/some/route\', function(req, res) {
var text = req.body; // I expect
By default bodyParser.text()
handles only text/plain. Change the type options to include */json
or */*
.
app.use('/some/route', bodyParser.text({type: '*/*'}), function(req, res) {
var text = req.body; // I expect text to be a string but it is a JSON
});
//or more generally:
app.use(bodyParser.text({type:"*/*"}));
You can find the docs here