Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1486

Is it correct to use a Nodejs https client? [closed]

$
0
0

I'm using below code sample for my Nodejs to call a https endpoint, is it a correct to implement it in this way?

const https = require('https');// process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;const options = {    hostname: 'jsonplaceholder.typicode.com',    port: 443,    path: '/users?_limit=2',    method: 'GET',    rejectUnauthorized: false  };  const req = https.request(options, (res) => {    console.log('statusCode---->:', res.statusCode);    console.log('headers----->:', res.headers);    res.on('data', (d) => {      process.stdout.write(d);    });  });  req.on('error', (e) => {    console.error(e);  });  req.end();

Viewing all articles
Browse latest Browse all 1486

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>