Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 39 for include_router (0.1 sec)

  1. docs/en/docs/reference/fastapi.md

        options:
            members:
                - openapi_version
                - webhooks
                - state
                - dependency_overrides
                - openapi
                - websocket
                - include_router
                - get
                - put
                - post
                - delete
                - options
                - head
                - patch
                - trace
                - on_event
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 19:53:19 UTC 2024
    - 701 bytes
    - Viewed (0)
  2. tests/test_custom_route_class.py

    
    @router_b.get("/")
    def get_b():
        return {"msg": "B"}
    
    
    @router_c.get("/")
    def get_c():
        return {"msg": "C"}
    
    
    router_b.include_router(router=router_c, prefix="/c")
    router_a.include_router(router=router_b, prefix="/b")
    app.include_router(router=router_a, prefix="/a")
    
    
    client = TestClient(app)
    
    
    @pytest.mark.parametrize(
        "path,expected_status,expected_response",
        [
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 3.1K bytes
    - Viewed (0)
  3. tests/test_ws_router.py

    async def router_ws_custom_error(websocket: WebSocket):
        raise CustomError()
    
    
    def make_app(app=None, **kwargs):
        app = app or FastAPI(**kwargs)
        app.include_router(router)
        app.include_router(prefix_router, prefix="/prefix")
        app.include_router(native_prefix_route)
        return app
    
    
    app = make_app(app)
    
    
    def test_app():
        client = TestClient(app)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Jun 11 19:08:14 UTC 2023
    - 7.5K bytes
    - Viewed (0)
  4. tests/test_empty_router.py

    from fastapi.exceptions import FastAPIError
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    router = APIRouter()
    
    
    @router.get("")
    def get_empty():
        return ["OK"]
    
    
    app.include_router(router, prefix="/prefix")
    
    
    client = TestClient(app)
    
    
    def test_use_empty():
        with client:
            response = client.get("/prefix")
            assert response.status_code == 200, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Jun 11 22:37:34 UTC 2023
    - 805 bytes
    - Viewed (0)
  5. tests/test_router_redirect_slashes.py

    
    def test_redirect_slashes_enabled():
        app = FastAPI()
        router = APIRouter()
    
        @router.get("/hello/")
        def hello_page() -> str:
            return "Hello, World!"
    
        app.include_router(router)
    
        client = TestClient(app)
    
        response = client.get("/hello/", follow_redirects=False)
        assert response.status_code == 200
    
        response = client.get("/hello", follow_redirects=False)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Jun 22 10:37:50 UTC 2023
    - 974 bytes
    - Viewed (0)
  6. tests/test_include_route.py

    from fastapi.testclient import TestClient
    
    app = FastAPI()
    router = APIRouter()
    
    
    @router.route("/items/")
    def read_items(request: Request):
        return JSONResponse({"hello": "world"})
    
    
    app.include_router(router)
    
    client = TestClient(app)
    
    
    def test_sub_router():
        response = client.get("/items/")
        assert response.status_code == 200, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Apr 08 04:37:38 UTC 2020
    - 496 bytes
    - Viewed (0)
  7. tests/test_generate_unique_id_function.py

            responses={404: {"model": List[Message]}},
        )
        def post_subrouter(item1: Item, item2: Item):
            return item1, item2  # pragma: nocover
    
        router.include_router(sub_router)
        app.include_router(router, generate_unique_id_function=custom_generate_unique_id3)
        client = TestClient(app)
        response = client.get("/openapi.json")
        data = response.json()
        assert data == {
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Jan 13 15:10:26 UTC 2024
    - 66.7K bytes
    - Viewed (0)
  8. docs/em/docs/tutorial/bigger-applications.md

    ## ๐Ÿ”Œ ๐ŸŽ ๐Ÿ“ป ๐Ÿ’— ๐Ÿ•ฐ โฎ๏ธ ๐ŸŽ `prefix`
    
    ๐Ÿ‘† ๐Ÿ’ช โš™๏ธ `.include_router()` ๐Ÿ’— ๐Ÿ•ฐ โฎ๏ธ *๐ŸŽ* ๐Ÿ“ป โš™๏ธ ๐ŸŽ ๐Ÿ”ก.
    
    ๐Ÿ‘‰ ๐Ÿ’ช โš , ๐Ÿ–ผ, ๐ŸŽฆ ๐ŸŽ ๐Ÿ› ๏ธ ๐Ÿ”ฝ ๐ŸŽ ๐Ÿ”ก, โœ… `/api/v1` & `/api/latest`.
    
    ๐Ÿ‘‰ ๐Ÿง โš™๏ธ ๐Ÿ‘ˆ ๐Ÿ‘† 5๏ธโƒฃ๐Ÿ“† ๐Ÿšซ ๐Ÿค™ ๐Ÿ’ช, โœ‹๏ธ โšซ๏ธ ๐Ÿ“ค ๐Ÿ’ผ ๐Ÿ‘†.
    
    ## ๐Ÿ”Œ `APIRouter` โž•1๏ธโƒฃ
    
    ๐ŸŽ ๐ŸŒŒ ๐Ÿ‘† ๐Ÿ’ช ๐Ÿ”Œ `APIRouter` `FastAPI` ๐Ÿˆธ, ๐Ÿ‘† ๐Ÿ’ช ๐Ÿ”Œ `APIRouter` โž•1๏ธโƒฃ `APIRouter` โš™๏ธ:
    
    ```Python
    router.include_router(other_router)
    ```
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 15.5K bytes
    - Viewed (0)
  9. docs/de/docs/tutorial/bigger-applications.md

    ```
    
    /// info
    
    `users.router` enthรคlt den `APIRouter` in der Datei `app/routers/users.py`.
    
    Und `items.router` enthรคlt den `APIRouter` in der Datei `app/routers/items.py`.
    
    ///
    
    Mit `app.include_router()` kรถnnen wir jeden `APIRouter` zur Hauptanwendung `FastAPI` hinzufรผgen.
    
    Es wird alle Routen von diesem Router als Teil von dieser inkludieren.
    
    /// note | "Technische Details"
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 21K bytes
    - Viewed (0)
  10. docs/en/docs/reference/apirouter.md

    You can import the `APIRouter` class directly from `fastapi`:
    
    ```python
    from fastapi import APIRouter
    ```
    
    ::: fastapi.APIRouter
        options:
            members:
                - websocket
                - include_router
                - get
                - put
                - post
                - delete
                - options
                - head
                - patch
                - trace
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 19:53:19 UTC 2024
    - 524 bytes
    - Viewed (0)
Back to top