Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for decorator (6.76 sec)

  1. tests/test_dependency_overrides.py

                    }
                ]
            }
        )
    
    
    def test_decorator_depends_q_foo():
        response = client.get("/decorator-depends/?q=foo")
        assert response.status_code == 200
        assert response.json() == {"in": "decorator-depends"}
    
    
    def test_decorator_depends_q_foo_skip_100_limit_200():
        response = client.get("/decorator-depends/?q=foo&skip=100&limit=200")
        assert response.status_code == 200
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 15.4K bytes
    - Viewed (0)
  2. fastapi/utils.py

                "field (e.g. Union[Response, dict, None]) you can disable generating the "
                "response model from the type annotation with the path operation decorator "
                "parameter response_model=None. Read more: "
                "https://fastapi.tiangolo.com/tutorial/response-model/"
            ) from None
    
    
    def create_cloned_field(
        field: ModelField,
        *,
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.8K bytes
    - Viewed (0)
  3. tests/test_ws_router.py

        await websocket.send_text(queryparam)
        await websocket.close()
    
    
    async def ws_dependency():
        return "Socket Dependency"
    
    
    @router.websocket("/router-ws-depends/")
    async def router_ws_decorator_depends(
        websocket: WebSocket, data=Depends(ws_dependency)
    ):
        await websocket.accept()
        await websocket.send_text(data)
        await websocket.close()
    
    
    @native_prefix_route.websocket("/")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Jun 11 19:08:14 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  4. tests/test_application.py

                    }
                },
                "/non_decorated_route": {
                    "get": {
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            }
                        },
                        "summary": "Non Decorated Route",
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 52.2K bytes
    - Viewed (0)
  5. fastapi/routing.py

            def decorator(func: DecoratedCallable) -> DecoratedCallable:
                self.add_route(
                    path,
                    func,
                    methods=methods,
                    name=name,
                    include_in_schema=include_in_schema,
                )
                return func
    
            return decorator
    
        def add_api_route(
            self,
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 170.1K bytes
    - Viewed (0)
  6. fastapi/applications.py

            ```
            """
    
            def decorator(func: DecoratedCallable) -> DecoratedCallable:
                self.add_api_websocket_route(
                    path,
                    func,
                    name=name,
                    dependencies=dependencies,
                )
                return func
    
            return decorator
    
        def include_router(
            self,
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 172.2K bytes
    - Viewed (0)
  7. tests/main.py

    app = FastAPI()
    
    
    @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)
    
    
    @app.get("/text")
    def get_text():
        return "Hello World"
    
    
    @app.get("/path/{item_id}")
    def get_id(item_id):
        return item_id
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 4.3K bytes
    - Viewed (0)
  8. tests/test_extra_routes.py

    
    @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}
    
    
    app.add_api_route("/items-not-decorated/{item_id}", get_not_decorated)
    
    
    @app.delete("/items/{item_id}")
    def delete_item(item_id: str, item: Item):
        return {"item_id": item_id, "item": item}
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 13.7K bytes
    - Viewed (0)
Back to top