Skip to content

Instantly share code, notes, and snippets.

@chukonu
Created April 17, 2019 07:39
Show Gist options
  • Save chukonu/82d8f38aa71e33e62ce8e122123b9725 to your computer and use it in GitHub Desktop.
Save chukonu/82d8f38aa71e33e62ce8e122123b9725 to your computer and use it in GitHub Desktop.
HTTP request w/ p12
'use strict';
const fs = require('fs');
const path = require('path');
const request = require('request');
const opts = {
url: '',
qs: {
},
headers: {
'content-type': 'application/json',
},
agentOptions: {
pfx: fs.readFileSync(path.resolve(__dirname, '')),
passphrase: '',
},
};
request.get(opts, (err, resp, body) => {
if (err) {
console.error(err);
return;
}
fs.writeFileSync(path.resolve(__dirname, ''), body);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment