forwardemail / forwardemail/superagent
Strange error with https request
- Dominant language
- JavaScript
- Stars
- 16.6k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Hi Team,
When i try to call the https url with **disableTLSCerts** both my error and success callbacks are being called.
**in failure**::Hostname/IP does not match certificate's altnames: Host: te-alm-34816742102591475476959.qa.com. is not cert's CN: qa_java
(node:75086) UnhandledPromiseRejectionWarning: Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames: Host: te-alm.qa.com. is not cert's CN: stage2_unifiedjava
at Object.checkServerIdentity (tls.js:297:12)
at TLSSocket.onConnectSecure (_tls_wrap.js:1507:27)
at TLSSocket.emit (events.js:315:20)
at TLSSocket._finishInit (_tls_wrap.js:932:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:706:12)
(node:75086) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
**in success 2**::200:::
CODE:
return req.send(sampleReq.postData)
.then(res => {
if (sampleReq.callBackFn !== undefined) {
return sampleReq.callBackFn(res.body)
} else {
console.log("in success 2::" + res.status + ":::" + res.text);
return res.body;
}
})
.catch((err) => {
console.log("in failure::" + err.message);
throw err;
});
Contributor guide
Assessment
This issue has not been assessed yet.