- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 27 for APIRoute (0.24 seconds)
The search processing time has exceeded the limit. The displayed results may be partial.
-
docs/en/docs/how-to/custom-request-and-route.md
# Custom Request and APIRoute class { #custom-request-and-apiroute-class } In some cases, you may want to override the logic used by the `Request` and `APIRoute` classes. In particular, this may be a good alternative to logic in a middleware. For example, if you want to read or manipulate the request body before it is processed by your application. /// danger This is an "advanced" feature.Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 4.4K bytes - Click Count (0) -
docs/zh-hant/docs/how-to/custom-request-and-route.md
# 自訂 Request 與 APIRoute 類別 { #custom-request-and-apiroute-class } 在某些情況下,你可能想要覆寫 `Request` 與 `APIRoute` 類別所使用的邏輯。 特別是,這可能是替代中介軟體(middleware)中實作邏輯的一個好方法。 例如,如果你想在應用程式處理之前讀取或操作請求本文(request body)。 /// danger 這是進階功能。 如果你剛開始使用 **FastAPI**,可以先跳過本節。 /// ## 使用情境 { #use-cases } 可能的使用情境包括: * 將非 JSON 的請求本文轉換為 JSON(例如 [`msgpack`](https://msgpack.org/index.html))。 * 解壓縮以 gzip 壓縮的請求本文。 * 自動記錄所有請求本文。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 4.2K bytes - Click Count (0) -
docs/ko/docs/how-to/custom-request-and-route.md
# 커스텀 Request 및 APIRoute 클래스 { #custom-request-and-apiroute-class } 일부 경우에는 `Request`와 `APIRoute` 클래스에서 사용되는 로직을 오버라이드하고 싶을 수 있습니다. 특히, 이는 middleware에 있는 로직의 좋은 대안이 될 수 있습니다. 예를 들어, 애플리케이션에서 처리되기 전에 요청 바디를 읽거나 조작하고 싶을 때가 그렇습니다. /// danger | 위험 이 기능은 "고급" 기능입니다. **FastAPI**를 이제 막 시작했다면 이 섹션은 건너뛰는 것이 좋습니다. /// ## 사용 사례 { #use-cases } 사용 사례에는 다음이 포함됩니다:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:06:26 GMT 2026 - 5.2K bytes - Click Count (0) -
docs_src/custom_request_and_route/tutorial002_py310.py
from collections.abc import Callable 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 - 935 bytes - Click Count (0) -
docs_src/custom_request_and_route/tutorial003_py310.py
import time from collections.abc import Callable from fastapi import APIRouter, FastAPI, Request, Response from fastapi.routing import APIRoute class TimedRoute(APIRoute): def get_route_handler(self) -> Callable: original_route_handler = super().get_route_handler() async def custom_route_handler(request: Request) -> Response: before = time.time()
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 10 08:55:32 GMT 2025 - 1K bytes - Click Count (0) -
fastapi/routing.py
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 15 11:44:39 GMT 2026 - 193K bytes - Click Count (0) -
docs/en/docs/advanced/generate-clients.md
FastAPI uses a **unique ID** for each *path operation*, which is used for the **operation ID** and also for the names of any needed custom models, for requests or responses. You can customize that function. It takes an `APIRoute` and outputs a string. For example, here it is using the first tag (you will probably have only one tag) and the *path operation* name (the function name).
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 9.7K bytes - Click Count (1) -
docs/ja/docs/advanced/generate-clients.md
### 一意 ID 生成関数のカスタマイズ { #custom-generate-unique-id-function } FastAPI は各 *path operation* に**一意 ID**を用いており、これは **operation ID** のほか、必要に応じてリクエストやレスポンスのカスタムモデル名にも使われます。 この関数はカスタマイズ可能です。`APIRoute` を受け取り、文字列を返します。 例えばここでは、最初のタグ(通常は 1 つ)と *path operation* 名(関数名)を使います。 そのカスタム関数を **FastAPI** の `generate_unique_id_function` パラメータに渡します: {* ../../docs_src/generate_clients/tutorial003_py310.py hl[6:7,10] *}Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:07:17 GMT 2026 - 11.1K bytes - Click Count (0) -
docs/ru/docs/how-to/custom-request-and-route.md
# Пользовательские классы Request и APIRoute { #custom-request-and-apiroute-class } В некоторых случаях может понадобиться переопределить логику, используемую классами `Request` и `APIRoute`. В частности, это может быть хорошей альтернативой логике в middleware. Например, если вы хотите прочитать или изменить тело запроса до того, как оно будет обработано вашим приложением. /// danger | Опасность Это «продвинутая» возможность.Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 17:56:20 GMT 2026 - 7.1K bytes - Click Count (0) -
docs/zh/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))。 * 解压缩使用 gzip 压缩的请求体。 * 自动记录所有请求体日志。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 4.1K bytes - Click Count (0)