Node.js post 请求

Nodejs post request

我正在尝试使用以下请求登录网站:

var request = require('request');

var options = {
method: 'POST',
url: 'https://server/EnterpriseController',
params: {a: 1},
form: "actionType=authenticateUser&reqObj=[null,username,password,null,1]",
headers: {
    'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'

},
withCredentials: true,
rejectUnauthorized: false
};

request(options,
function (error, response, body, data) {

    if (request.method === 'POST') {
        var body = '';
        request.on('data', function (data) {
            body += data;
        });
        request.on('end', function () {
            var post = qs.parse(body);
        });
    }
    console.log(body);
}
);

我总是遇到错误。我认为表格有误,但我在 angularjs 网站上有相同的登录名,没有任何错误。我不明白为什么登录在 angularjs 网站上有效,但在 nodejs 中无效。

 )]}',
 {"login_err": true, "resp": [null,null,null,1]
 }

我错过了 cookie:/ Formdata 应该是一个对象。