Initial curated CertScope source from fe2bbe3ca5c98bf64be26a09c6c58ee805a7f87e

This commit is contained in:
Public Source Publisher committed 2026-10-01 01:30:09 +02:00
commit 7348faf6c0
65 files changed
+12509

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
export type HttpStatusTone = "green" | "amber" | "red" | "muted";
export type HttpStatusSemantics = {
label: "Incomplete" | "Informational response" | "Healthy response" | "Redirect response" | "Client error" | "Server error";
tone: HttpStatusTone;
};
export function statusForHttp(status: unknown): HttpStatusSemantics {
if (typeof status !== "number" || !Number.isInteger(status) || status < 100 || status > 599) {
return { label: "Incomplete", tone: "muted" };
}
if (status < 200) return { label: "Informational response", tone: "muted" };
if (status < 300) return { label: "Healthy response", tone: "green" };
if (status < 400) return { label: "Redirect response", tone: "muted" };
if (status < 500) return { label: "Client error", tone: "amber" };
return { label: "Server error", tone: "red" };
}