fix: return appropriate HTTP status based on health check

This commit is contained in:
Sam Chau
2026-01-23 21:55:29 +10:30
parent 7815dd7813
commit 3eb71f4c3f

View File

@@ -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 {