diff --git a/litellm/proxy/health_endpoints/_health_endpoints.py b/litellm/proxy/health_endpoints/_health_endpoints.py index 07be73d7573..e3ec9786cdb 100644 --- a/litellm/proxy/health_endpoints/_health_endpoints.py +++ b/litellm/proxy/health_endpoints/_health_endpoints.py @@ -469,6 +469,7 @@ async def health_services_endpoint( type="user_budget", user_info=user_info, ) + return {"status": "success", "message": "Mock webhook alert sent"} elif service == "sqs": from litellm.integrations.sqs import SQSLogger diff --git a/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.py b/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.py index 3ec5176159d..bcf55a09d84 100644 --- a/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.py +++ b/tests/test_litellm/proxy/health_endpoints/test_health_endpoints.py @@ -270,6 +270,36 @@ async def test_health_services_endpoint_sqs(status, error_message): mock_instance.async_health_check.assert_awaited_once() +@pytest.mark.asyncio +async def test_health_services_endpoint_webhook_returns_structured_response(): + """ + Regression test: the /health/services webhook branch called + proxy_logging_obj.budget_alerts() but had no return statement, so + execution fell through to the end of the function and returned None + (serialized as JSON null with HTTP 200) instead of a structured + {"status": ..., "message": ...} dict like every other service branch. + """ + user_api_key_dict = UserAPIKeyAuth( + token="test-token", + user_id="test-user", + key_alias="test-key-alias", + team_id="test-team", + ) + mock_budget_alerts = AsyncMock() + + with patch( + "litellm.proxy.proxy_server.proxy_logging_obj.budget_alerts", + mock_budget_alerts, + ): + result = await health_services_endpoint( + user_api_key_dict=user_api_key_dict, + service="webhook", + ) + + mock_budget_alerts.assert_awaited_once() + assert result == {"status": "success", "message": "Mock webhook alert sent"} + + @pytest.mark.asyncio async def test_health_license_endpoint_with_active_license(): license_data = {