Node js Request body type is [Object, Object]
Looks like you need to post via form data - which through request
[forms] - will apply the appropriate application/x-www-form-urlencoded
http header. Observe the following...
// -- notice the keyed object being sent
request.post('http://127.0.0.1:8000/', {
form: {customKey: 'testing'}
}, function (err, httpResponse, body) {
console.log(body); // post success!
});
On your endpoint, if you want to log this out you can then do so as such...
app.post('/', function (req, res) {
console.log('post/ ', req.body.customKey'); // -- post/ testing
res.send('post success!');
});
If you want to see [object Object] content in console.log try this:
const util = require('util');
...
console.log(`post/${util.inspect(req.body,false,null)}`);
More info: util.inspect