post请求有几种数据的发送方式,body\form…,根据接口需求传递
后台nodejs
向微信发起post 请求方式
// req.body 就是前台传过来的数据let url = `https://api./cgi-bin/material/batchget_material?access_token=${req.body.access_token}`;let data = {type: "image",offset: req.body.pageSize * (req.body.currenPage - 1),count: req.body.pageSize,};// post form表单形式request.post({url: url,form: JSON.stringify(data)}, function (error, response, body) {if (!error && response.statusCode == 200) {console.log(body) // 请求成功的处理逻辑 }})// post body形式// request({// url: url,// method: "POST",// json: true,// headers: {//"content-type": "application/json",// },// body: JSON.stringify(data)// }, function (error, response, body) {// console.log("response************************");// console.log(response);// console.log("response************************");// if (!error && response.statusCode == 200) {//console.log(body) // 请求成功的处理逻辑// }// next();// });