How do I use the node.js request module to make an SSL call with my own certificate?

前端 未结 4 1175
悲&欢浪女
悲&欢浪女 2020-12-16 11:32

I\'m using node.js and this request module to make HTTP calls to another server.

https://github.com/mikeal/request

It works great. I now need to modify this

4条回答
  •  难免孤独
    2020-12-16 12:00

    const request = require('request');
    
    request.post({
                    url: strRSAUrl,
                    agentOptions: {
                        ca: fs.readFileSync('path-to-cacert.pem')
                    },
                    form: {
                        some_key: some_value,
                    }
                }, function (error, response, body) {
                    objResponse.send(body);
                });
    

    For more details,you can refer from nodejs#request

提交回复
热议问题