mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-02 13:33:40 +01:00
Add fallback to HTTP GET for ping
This commit is contained in:
parent
4f9df3c9e7
commit
33bd349e43
@ -15,11 +15,18 @@ export default async function handler(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
const startTime = performance.now();
|
||||
const [status] = await httpProxy(pingURL, {
|
||||
let startTime = performance.now();
|
||||
let [status] = await httpProxy(pingURL, {
|
||||
method: "HEAD"
|
||||
});
|
||||
const endTime = performance.now();
|
||||
let endTime = performance.now();
|
||||
|
||||
if (status >= 400 && status < 500) {
|
||||
// try one more time as a GET in case HEAD is rejected for whatever reason
|
||||
startTime = performance.now();
|
||||
[status] = await httpProxy(pingURL);
|
||||
endTime = performance.now();
|
||||
}
|
||||
|
||||
return res.status(200).json({
|
||||
status,
|
||||
|
Loading…
x
Reference in New Issue
Block a user