- Sort Score
- Result 10 results
- Languages All
Results 1 - 5 of 5 for add_route (0.04 sec)
-
fastapi/routing.py
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 12:54:56 UTC 2025 - 174.6K bytes - Viewed (0) -
fastapi/applications.py
) self.add_route(self.docs_url, swagger_ui_html, include_in_schema=False) if self.swagger_ui_oauth2_redirect_url: async def swagger_ui_redirect(req: Request) -> HTMLResponse: return get_swagger_ui_oauth2_redirect_html() self.add_route( self.swagger_ui_oauth2_redirect_url,Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 176.3K bytes - Viewed (0) -
tests/main.py
external_docs = { "description": "External API documentation.", "url": "https://docs.example.com/api-general", } app = FastAPI(openapi_external_docs=external_docs) @app.api_route("/api_route") def non_operation(): return {"message": "Hello World"} def non_decorated_route(): return {"message": "Hello World"} app.add_api_route("/non_decorated_route", non_decorated_route)Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 4.5K bytes - Viewed (0) -
tests/test_application.py
import pytest from fastapi.testclient import TestClient from .main import app client = TestClient(app) @pytest.mark.parametrize( "path,expected_status,expected_response", [ ("/api_route", 200, {"message": "Hello World"}), ("/non_decorated_route", 200, {"message": "Hello World"}), ("/nonexistent", 404, {"detail": "Not Found"}), ], ) def test_get_path(path, expected_status, expected_response):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 51.9K bytes - Viewed (0) -
tests/test_extra_routes.py
from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str price: Optional[float] = None @app.api_route("/items/{item_id}", methods=["GET"]) def get_items(item_id: str): return {"item_id": item_id} def get_not_decorated(item_id: str): return {"item_id": item_id}
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 13.5K bytes - Viewed (0)