Skip to content

Instantly share code, notes, and snippets.

@SilentImp
Last active June 22, 2018 16:27
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
const certPath = resolve(__dirname, '../../../id.cer');
const keyPath = resolve(__dirname, '../../../id.pem');
const { uri } = req.body;
const myURL = url.parse(uri);
const cert = fs.readFileSync(certPath);
const key = fs.readFileSync(keyPath);
const options = {
url: `${url}`,
hostname: myURL.hostname,
path: myURL.path,
method: 'POST',
key,
cert,
json: true,
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
};
console.warn('options: ', options);
const request = https.request(options, function(responce) {
console.log("statusCode: ", responce.statusCode);
console.log("headers: ", responce.headers);
responce.on('data', function(data){
console.log(JSON.stringify(data));
});
});
error on verification: Error: error:0906D06C:PEM routines:PEM_read_bio:no start line
at Object.createSecureContext (_tls_common.js:140:17)
at Object.exports.connect (_tls_wrap.js:1116:48)
at Agent.createConnection (https.js:122:22)
at Agent.createSocket (_http_agent.js:227:26)
at Agent.addRequest (_http_agent.js:185:10)
at new ClientRequest (_http_client.js:263:16)
at Object.request (https.js:275:10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment