我想使用Node.js生成POST请求,但我缺少的部分是“ X-CSRF-TOKEN”,我不知道如何发送。这是我需要的唯一一件事。这是我的代码
let request = require('request');
let url = 'https://gamehag.com/api/v1/register';
let headers = {
'User-Agent' : 'Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0',
'Accept': '*/*',
'Content-Type' : 'application/x-www-form-urlencoded; charset=UTF-8',
// 'X-CSRF-TOKEN' : '' HERE MAGIC HAPPENS
};
let form = {
name: 'nicolas88',
email: 'nicolas88@gmail.com',
passowrd: 'nicolas88'
};
request.post({
url,
headers,
form,
method: 'POST'
}, (err, res, body) => {
console.log(body);
});
还有图片image