- Sort Score
- Result 10 results
- Languages All
Results 31 - 39 of 39 for include_router (0.23 sec)
-
tests/test_custom_middleware_exception.py
await self.app(scope, wrapper, send) @router.post("/middleware") def run_middleware(file: UploadFile = File(..., description="Big File")): return {"message": "OK"} app.include_router(router) app.add_middleware(ContentSizeLimitMiddleware, max_content_size=2**8) client = TestClient(app) def test_custom_middleware_exception(tmp_path: Path): default_pydantic_max_size = 2**16
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Aug 25 21:44:40 GMT 2022 - 2.8K bytes - Viewed (0) -
docs/de/docs/advanced/testing-dependencies.md
Die ursprüngliche Abhängigkeit könnte in einer *Pfadoperation-Funktion*, einem *Pfadoperation-Dekorator* (wenn Sie den Rückgabewert nicht verwenden), einem `.include_router()`-Aufruf, usw. verwendet werden. FastAPI kann sie in jedem Fall überschreiben. Anschließend können Sie Ihre Überschreibungen zurücksetzen (entfernen), indem Sie `app.dependency_overrides` auf ein leeres `dict` setzen:
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Mar 30 20:17:32 GMT 2024 - 3.6K bytes - Viewed (0) -
docs/en/docs/advanced/testing-dependencies.md
The original dependency could be used in a *path operation function*, a *path operation decorator* (when you don't use the return value), a `.include_router()` call, etc. FastAPI will still be able to override it. Then you can reset your overrides (remove them) by setting `app.dependency_overrides` to be an empty `dict`: ```Python app.dependency_overrides = {}
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Tue Oct 17 05:59:11 GMT 2023 - 2.9K bytes - Viewed (0) -
tests/test_dependency_overrides.py
@router.get("/router-decorator-depends/", dependencies=[Depends(common_parameters)]) async def router_decorator_depends(): return {"in": "router-decorator-depends"} app.include_router(router) client = TestClient(app) async def overrider_dependency_simple(q: Optional[str] = None): return {"q": q, "skip": 5, "limit": 10} async def overrider_sub_dependency(k: str):
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) -
docs/en/docs/release-notes.md
That means that, for example, to apply authentication to all the *path operations* in a router it would end up being done in a different file, instead of keeping related logic together.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri May 03 23:25:42 GMT 2024 - 388.1K bytes - Viewed (1) -
tests/test_sub_callbacks.py
(e.g. "payment successful"). """ # Send the invoice, collect the money, send the notification (the callback) return {"msg": "Invoice received"} app.include_router(subrouter, callbacks=events_callback_router.routes) client = TestClient(app) def test_get(): response = client.post( "/invoices/", json={"id": "fooinvoice", "customer": "John", "total": 5.3}
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Jul 07 17:12:13 GMT 2023 - 13.8K bytes - Viewed (0) -
fastapi/routing.py
users_router = APIRouter() @users_router.get("/users/") def read_users(): return [{"name": "Rick"}, {"name": "Morty"}] internal_router.include_router(users_router) app.include_router(internal_router) ``` """ if prefix: assert prefix.startswith("/"), "A path prefix must start with '/'" assert not prefix.endswith(
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) -
tests/test_annotated.py
app = FastAPI() router = APIRouter(prefix="/nested") @router.get("/test") async def test(var: Annotated[str, Query()] = "bar"): return {"foo": var} app.include_router(router) client = TestClient(app) response = client.get("/nested/test") assert response.status_code == 200 assert response.json() == {"foo": "bar"} def test_openapi_schema():
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:40:57 GMT 2024 - 10.2K bytes - Viewed (0) -
fastapi/applications.py
```python from fastapi import FastAPI from .users import users_router app = FastAPI() app.include_router(users_router) ``` """ self.router.include_router( router, prefix=prefix, tags=tags, dependencies=dependencies, responses=responses,
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)