Merge pull request #6 from TheGuyDanish/patch-1

Introduce custom user agent. Fixes #5
This commit is contained in:
Louis Lam 2021-07-12 09:39:15 +08:00 committed by GitHub
commit 35ce54f30c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -71,7 +71,9 @@ class Monitor extends BeanModel {
try {
if (this.type === "http" || this.type === "keyword") {
let startTime = dayjs().valueOf();
let res = await axios.get(this.url)
let res = await axios.get(this.url, {
headers: { 'User-Agent':'Uptime-Kuma' }
})
bean.msg = `${res.status} - ${res.statusText}`
bean.ping = dayjs().valueOf() - startTime;