Quantcast
Channel: CNode:Node.js专业中文社区
Viewing all articles
Browse latest Browse all 14821

不太理解https.get()怎么加入headers?

$
0
0

我看了下api貌似没有讲。。。

const https = require('https');

process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

https.get({host:'https://10.*.*.*:8183/',headers:{'user-agent':'fuckoude'}},(res) => {
  console.log('statusCode:', res.statusCode);
  console.log('headers:', res.headers);

  res.on('data', (d) => {
  	console.log('..');
    // process.stdout.write(d);
  });

}).on('error', (e) => {
  console.error(e);
});

Viewing all articles
Browse latest Browse all 14821

Trending Articles