diff --git a/airbyte_cdk/manifest_server/routers/capabilities.py b/airbyte_cdk/manifest_server/routers/capabilities.py index 2b630c2742..51ea24ba0a 100644 --- a/airbyte_cdk/manifest_server/routers/capabilities.py +++ b/airbyte_cdk/manifest_server/routers/capabilities.py @@ -11,6 +11,7 @@ ) +@router.get("", include_in_schema=False) @router.get("/", operation_id="getCapabilities") def get_capabilities() -> CapabilitiesResponse: """ diff --git a/airbyte_cdk/manifest_server/routers/health.py b/airbyte_cdk/manifest_server/routers/health.py index 96e46e4eac..966ac433e0 100644 --- a/airbyte_cdk/manifest_server/routers/health.py +++ b/airbyte_cdk/manifest_server/routers/health.py @@ -8,6 +8,7 @@ ) +@router.get("", include_in_schema=False) @router.get("/") def health() -> Dict[str, str]: return {"status": "ok"} diff --git a/unit_tests/manifest_server/routers/test_capabilities.py b/unit_tests/manifest_server/routers/test_capabilities.py index 4c7d73f883..b5540d97c2 100644 --- a/unit_tests/manifest_server/routers/test_capabilities.py +++ b/unit_tests/manifest_server/routers/test_capabilities.py @@ -5,7 +5,7 @@ from airbyte_cdk.manifest_server.app import app -client = TestClient(app) +client = TestClient(app, follow_redirects=False) class TestCapabilities: @@ -16,6 +16,11 @@ def test_capabilities_endpoint_exists(self): response = client.get("/capabilities/") assert response.status_code == 200 + def test_capabilities_endpoint_without_trailing_slash(self): + """Test that the capabilities endpoint does not redirect without a trailing slash.""" + response = client.get("/capabilities") + assert response.status_code == 200 + def test_capabilities_custom_code_execution_false_by_default(self): """Test that custom_code_execution is false by default when env var is not set.""" with patch.dict(os.environ, {}, clear=True): diff --git a/unit_tests/manifest_server/routers/test_health.py b/unit_tests/manifest_server/routers/test_health.py new file mode 100644 index 0000000000..dfdffe353d --- /dev/null +++ b/unit_tests/manifest_server/routers/test_health.py @@ -0,0 +1,18 @@ +from fastapi.testclient import TestClient + +from airbyte_cdk.manifest_server.app import app + +client = TestClient(app, follow_redirects=False) + + +def test_health_endpoint_without_trailing_slash() -> None: + response = client.get("/health") + + assert response.status_code == 200 + assert response.json() == {"status": "ok"} + + +def test_health_endpoint_with_trailing_slash() -> None: + response = client.get("/health/") + + assert response.status_code == 200