- Sort Score
- Num 10 results
- Language All
Results 11 - 20 of 47 for apiNote (0.05 seconds)
The search processing time has exceeded the limit. The displayed results may be partial.
-
docs/fr/docs/how-to/custom-request-and-route.md
# Personnaliser les classes Request et APIRoute { #custom-request-and-apiroute-class } Dans certains cas, vous pouvez vouloir surcharger la logique utilisée par les classes `Request` et `APIRoute`. En particulier, cela peut être une bonne alternative à une logique dans un middleware. Par exemple, si vous voulez lire ou manipuler le corps de la requête avant qu'il ne soit traité par votre application. /// danger | DangerCreated: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:37:13 GMT 2026 - 5.1K bytes - Click Count (0) -
docs/es/docs/how-to/custom-request-and-route.md
# Clase personalizada de Request y APIRoute { #custom-request-and-apiroute-class } En algunos casos, puede que quieras sobrescribir la lógica utilizada por las clases `Request` y `APIRoute`. En particular, esta puede ser una buena alternativa a la lógica en un middleware. Por ejemplo, si quieres leer o manipular el request body antes de que sea procesado por tu aplicación. /// danger | Advertencia Esta es una funcionalidad "avanzada".Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:15:55 GMT 2026 - 4.8K bytes - Click Count (0) -
fastapi/openapi/utils.py
def generate_operation_summary(*, route: routing.APIRoute, method: str) -> str: if route.summary: return route.summary return route.name.replace("_", " ").title() def get_openapi_operation_metadata( *, route: routing.APIRoute, method: str, operation_ids: set[str] ) -> dict[str, Any]: operation: dict[str, Any] = {} if route.tags:
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 15 11:44:39 GMT 2026 - 25.6K bytes - Click Count (0) -
tests/test_custom_route_class.py
import pytest from fastapi import APIRouter, FastAPI from fastapi.routing import APIRoute from fastapi.testclient import TestClient from inline_snapshot import snapshot from starlette.routing import Route app = FastAPI() class APIRouteA(APIRoute): x_type = "A" class APIRouteB(APIRoute): x_type = "B" class APIRouteC(APIRoute): x_type = "C" router_a = APIRouter(route_class=APIRouteA)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:18:38 GMT 2026 - 3.3K bytes - Click Count (0) -
docs_src/path_operation_advanced_configuration/tutorial002_py310.py
from fastapi import FastAPI from fastapi.routing import APIRoute app = FastAPI() @app.get("/items/") async def read_items(): return [{"item_id": "Foo"}] def use_route_names_as_operation_ids(app: FastAPI) -> None: """ Simplify operation IDs so that generated API clients have simpler function names. Should be called only after all routes have been added. """ for route in app.routes:
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 572 bytes - Click Count (0) -
docs_src/custom_request_and_route/tutorial001_py310.py
from fastapi.routing import APIRoute class GzipRequest(Request): async def body(self) -> bytes: if not hasattr(self, "_body"): body = await super().body() if "gzip" in self.headers.getlist("Content-Encoding"): body = gzip.decompress(body) self._body = body return self._body class GzipRoute(APIRoute): def get_route_handler(self) -> Callable:
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 10 08:55:32 GMT 2025 - 976 bytes - Click Count (0) -
docs_src/custom_request_and_route/tutorial001_an_py310.py
from fastapi.routing import APIRoute class GzipRequest(Request): async def body(self) -> bytes: if not hasattr(self, "_body"): body = await super().body() if "gzip" in self.headers.getlist("Content-Encoding"): body = gzip.decompress(body) self._body = body return self._body class GzipRoute(APIRoute): def get_route_handler(self) -> Callable:
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 10 08:55:32 GMT 2025 - 1015 bytes - Click Count (0) -
docs/ja/docs/how-to/custom-request-and-route.md
# カスタム Request と APIRoute クラス { #custom-request-and-apiroute-class } 場合によっては、`Request` や `APIRoute` クラスで使われるロジックを上書きしたいことがあります。 特に、ミドルウェアでのロジックの代替として有効な場合があります。 たとえば、アプリケーションで処理される前にリクエストボディを読み取ったり操作したりしたい場合です。 /// danger | 警告 これは「上級」機能です。 FastAPI を始めたばかりの場合は、このセクションは読み飛ばしてもよいでしょう。 /// ## ユースケース { #use-cases } ユースケースの例: * JSON ではないリクエストボディを JSON に変換する(例: [`msgpack`](https://msgpack.org/index.html))。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:07:17 GMT 2026 - 5.4K bytes - Click Count (0) -
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}")
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Mon Sep 29 03:29:38 GMT 2025 - 1.5K bytes - Click Count (0) -
docs_src/custom_request_and_route/tutorial002_an_py310.py
from typing import Annotated from fastapi import Body, FastAPI, HTTPException, Request, Response from fastapi.exceptions import RequestValidationError from fastapi.routing import APIRoute class ValidationErrorLoggingRoute(APIRoute): def get_route_handler(self) -> Callable: original_route_handler = super().get_route_handler() async def custom_route_handler(request: Request) -> Response: try:
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 10 08:55:32 GMT 2025 - 974 bytes - Click Count (0)