Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for APIWebSocketRoute (0.1 sec)

  1. tests/test_route_scope.py

    import pytest
    from fastapi import FastAPI, Request, WebSocket, WebSocketDisconnect
    from fastapi.routing import APIRoute, APIWebSocketRoute
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    @app.get("/users/{user_id}")
    async def get_user(user_id: str, request: Request):
        route: APIRoute = request.scope["route"]
        return {"user_id": user_id, "path": route.path}
    
    
    @app.websocket("/items/{item_id}")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Feb 08 10:23:07 UTC 2023
    - 1.5K bytes
    - Viewed (0)
  2. fastapi/routing.py

                    )
                assert dependant.call is not None, "dependant.call must be a function"
                await dependant.call(**solved_result.values)
    
        return app
    
    
    class APIWebSocketRoute(routing.WebSocketRoute):
        def __init__(
            self,
            path: str,
            endpoint: Callable[..., Any],
            *,
            name: Optional[str] = None,
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Oct 12 09:44:57 UTC 2024
    - 172.1K bytes
    - Viewed (0)
Back to top