Merge branch 'hotfix-release'

This commit is contained in:
Nawaz Dhandala 2021-05-14 09:49:46 +01:00
commit e743a49c62

View File

@ -92,7 +92,15 @@ const pingfetch = async (url, method, body, headers) => {
*/
response = await fetch(url, { ...payload });
res = new Date().getTime() - now;
data = await response.json();
try {
/* Try getting response json body
If this fails, body is either empty or not valid json
and data should return null
*/
data = await response.json();
} catch (e) {
//
}
if (urlObject.protocol === 'https:') {
const certificate = await sslCert.get(urlObject.hostname);
if (certificate) {
@ -121,7 +129,15 @@ const pingfetch = async (url, method, body, headers) => {
: { agent: httpAgent }),
});
res = new Date().getTime() - now;
data = await response.json();
try {
/* Try getting response json body
If this fails, body is either empty or not valid json
and data should return null
*/
data = await response.json();
} catch (e) {
//
}
if (urlObject.protocol === 'https:') {
const certificate = await sslCert.get(urlObject.hostname);
if (certificate) {