Adds http_code to heartbeatJSON

This commit is contained in:
Niyas 2021-08-14 08:13:23 +05:30 committed by GitHub
parent af34e861c5
commit 82dd4cec96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -131,6 +131,7 @@ class Monitor extends BeanModel {
});
bean.msg = `${res.status} - ${res.statusText}`
bean.ping = dayjs().valueOf() - startTime;
bean.http_code = `${res.status}`
// Check certificate if https is used
@ -189,9 +190,12 @@ class Monitor extends BeanModel {
retries = 0;
} catch (error) {
bean.msg = error.message;
if (error.response) {
bean.http_code = error.response.status;
}
// If UP come in here, it must be upside down mode
// Just reset the retries
if (this.isUpsideDown() && bean.status === UP) {