Browse Source

add example with request module

master
AJ ONeal 6 years ago
parent
commit
9bab728f8b
  1. 21
      request-with-request.js

21
request-with-request.js

@ -0,0 +1,21 @@
#!/usr/bin/env node
'use strict';
var fs = require('fs');
var path = require('path');
var request = require('request');
var ca = fs.readFileSync(path.join(__dirname, 'certs', 'client', 'chain.pem'));
var port = process.argv[2] || 8043;
var hostname = process.argv[3] || 'localhost.daplie.com';
var options = {
url: 'https://' + hostname + ':' + port
, agentOptions: {
ca: ca
}
};
request.get(options, function (err, resp) {
console.log(resp.body);
});
Loading…
Cancel
Save