我终于设法做到了。在下面的代码段中回答:
var querystring = require('querystring');var request = require('request');var form = { username: 'usr', password: 'pwd', opaque: 'opaque', logintype: '1'};var formData = querystring.stringify(form);var contentLength = formData.length;request({ headers: { 'Content-Length': contentLength, 'Content-Type': 'application/x-www-form-urlenpred' }, uri: 'http://myUrl', body: formData, method: 'POST' }, function (err, res, body) { //it works! });


