Guest User

Untitled

a guest
Jan 6th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const https = require('https');
  2.  
  3. const options = {
  4.   hostname: 'encrypted.google.com',
  5.   port: 443,
  6.   path: '/',
  7.   method: 'GET'
  8. };
  9.  
  10. const req = https.request(options, (res) => {
  11.   console.log('statusCode:', res.statusCode);
  12.   console.log('headers:', res.headers);
  13.  
  14.   res.on('data', (d) => {
  15.     process.stdout.write(d);
  16.   });
  17. });
  18.  
  19. req.on('error', (e) => {
  20.   console.error(e);
  21. });
  22. req.end();
Advertisement
Add Comment
Please, Sign In to add comment