This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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