Chore: simplify sanitizeErrorURL

This commit is contained in:
shamoon
2026-08-07 08:15:09 -07:00
parent d8b2a33d5b
commit 162593c0e9
9 changed files with 30 additions and 38 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ describe("widgets/dockhand/proxy", () => {
expect(res.statusCode).toBe(500);
expect(res.body.error.message).toBe("HTTP Error");
expect(res.body.error.url).toContain("token=***");
expect(res.body.error.url).toBe("dockhand (see logs for details)");
});
it("supports token auth", async () => {
+10 -2
View File
@@ -47,7 +47,14 @@ export default async function frigateProxyHandler(req, res, map) {
});
if (loginStatus !== 200) {
logger.error("HTTP Error %d calling %s", loginStatus, sanitizeErrorURL(loginUrl));
const errorURL = new URL(loginUrl);
logger.error(
"HTTP Error %d calling %s//%s%s...",
loginStatus,
errorURL.protocol,
errorURL.host,
errorURL.pathname,
);
return res.status(status).json({
error: {
message: `HTTP Error ${status} while trying to login to Frigate`,
@@ -63,7 +70,8 @@ export default async function frigateProxyHandler(req, res, map) {
}
if (status >= 400) {
logger.error("HTTP Error %d calling %s", status, sanitizeErrorURL(url));
const errorURL = new URL(url);
logger.error("HTTP Error %d calling %s//%s%s...", status, errorURL.protocol, errorURL.host, errorURL.pathname);
return res.status(status).json({
error: {
message: `HTTP Error ${status} from Frigate`,
+2 -2
View File
@@ -99,7 +99,7 @@ describe("widgets/frigate/proxy", () => {
expect.objectContaining({
error: expect.objectContaining({
message: "HTTP Error 401 from Frigate",
url: "http://frigate/api/stats",
url: "frigate (see logs for details)",
}),
}),
);
@@ -162,7 +162,7 @@ describe("widgets/frigate/proxy", () => {
expect.objectContaining({
error: expect.objectContaining({
message: "HTTP Error 401 while trying to login to Frigate",
url: "http://frigate/api/stats",
url: "frigate (see logs for details)",
}),
}),
);
+2 -1
View File
@@ -34,7 +34,8 @@ export default async function komodoProxyHandler(req, res) {
let resultData = data;
if (status >= 400) {
logger.error("HTTP Error %d calling %s", status, sanitizeErrorURL(url));
const errorURL = new URL(url);
logger.error("HTTP Error %d calling %s//%s%s...", status, errorURL.protocol, errorURL.host, errorURL.pathname);
}
if (status === 200) {