From 6d1db787093e8f6fd2abd45c80246cdac6ccd803 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Fri, 14 Apr 2023 10:32:12 -0700 Subject: [PATCH] Accept http 401 / 403 for ping --- src/components/services/ping.jsx | 14 ++++++-------- src/pages/api/ping.js | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/components/services/ping.jsx b/src/components/services/ping.jsx index e30562323..7358b172f 100644 --- a/src/components/services/ping.jsx +++ b/src/components/services/ping.jsx @@ -25,7 +25,7 @@ export default function Ping({ service }) { const statusText = `${service.ping}: HTTP status ${data.status}`; - if (data && data.status !== 200) { + if (data.status > 403) { return (
{data.status}
@@ -33,12 +33,10 @@ export default function Ping({ service }) { ); } - if (data && data.status === 200) { - return ( -
-
{t("common.ms", { value: data.latency, style: "unit", unit: "millisecond", unitDisplay: "narrow", maximumFractionDigits: 0 })}
-
- ); - } + return ( +
+
{t("common.ms", { value: data.latency, style: "unit", unit: "millisecond", unitDisplay: "narrow", maximumFractionDigits: 0 })}
+
+ ); } diff --git a/src/pages/api/ping.js b/src/pages/api/ping.js index 66eab281c..1fdb1f804 100644 --- a/src/pages/api/ping.js +++ b/src/pages/api/ping.js @@ -21,7 +21,7 @@ export default async function handler(req, res) { }); let endTime = performance.now(); - if (status >= 400) { + if (status > 403) { // try one more time as a GET in case HEAD is rejected for whatever reason startTime = performance.now(); [status] = await httpProxy(pingURL);