request请求携带证书,如:微信企业零钱付款

 

 

const Promise = require('bluebird')

const request = Promise.promisifyAll(require('request'))

const wxTransferResult = await request.postAsync({
url: 'https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers',
body:{user:'aaaaaa'} ,
agentOptions: {
      cert: fse.readFileSync(path.join(__dirname, '../wx_cert.pem')).toString(), 
      key: fse.readFileSync(path.join(__dirname, '../wx_key.pem')).toString()
   }
})

 

详情参考:https://www.npmjs.com/package/request

posted @ 2018-12-11 10:51  江山一族  阅读(1443)  评论(0编辑  收藏  举报