Browse Source

Adds http_code to heartbeatJSON

pull/215/head
Niyas 4 years ago
committed by GitHub
parent
commit
82dd4cec96
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      server/model/monitor.js

6
server/model/monitor.js

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

Loading…
Cancel
Save