From 3eb71f4c3fa4eeb31fb05be1703a1040f37467ae Mon Sep 17 00:00:00 2001 From: Sam Chau Date: Fri, 23 Jan 2026 21:55:29 +1030 Subject: [PATCH] fix: return appropriate HTTP status based on health check --- src/routes/api/v1/health/+server.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/api/v1/health/+server.ts b/src/routes/api/v1/health/+server.ts index 3b0a24a..203b5bd 100644 --- a/src/routes/api/v1/health/+server.ts +++ b/src/routes/api/v1/health/+server.ts @@ -34,10 +34,10 @@ export const GET: RequestHandler = async () => { } }; - // Determine overall status response.status = determineOverallStatus(response.components); - return json(response); + const httpStatus = response.status === 'unhealthy' ? 503 : 200; + return json(response, { status: httpStatus }); }; function determineOverallStatus(components: HealthResponse['components']): ComponentStatus {