nodejs request 传参数

var appid = “";
var secret ="
*”;
var js_code =req.body.code;
request({
url: ‘https://api.weixin.qq.com/sns/jscode2session?appid=’+appid+’&secret=’+secret+’&js_code=’+js_code+’&grant_type=authorization_code’,
method: “get”,
json: true,
headers: {
“content-type”: “application/json”,
},
body: JSON.stringify(request)
}, function(error, response, body) {
if (!error && response.statusCode == 200) {
}
console.log(response.body);
res.send(response.body);
});

你可能感兴趣的:(nodejs,reuest)