- Sort Score
- Result 10 results
- Languages All
Results 1 - 4 of 4 for routes (0.15 sec)
-
docs/zh/docs/advanced/custom-request-and-route.md
```Python hl_lines="8-15" {!../../../docs_src/custom_request_and_route/tutorial001.py!} ``` ### 创建自定义 `GzipRoute` 类 接下来,创建使用 `GzipRequest` 的 `fastapi.routing.APIRoute ` 的自定义子类。 此时,这个自定义子类会覆盖 `APIRoute.get_route_handler()`。 `APIRoute.get_route_handler()` 方法返回的是函数,并且返回的函数接收请求并返回响应。 本例用它根据原始请求创建 `GzipRequest`。 ```Python hl_lines="18-26" {!../../../docs_src/custom_request_and_route/tutorial001.py!} ``` !!! note "技术细节"
Plain Text - Registered: Sun Mar 31 07:19:09 GMT 2024 - Last Modified: Sat Mar 30 22:45:40 GMT 2024 - 3.8K bytes - Viewed (0) -
docs/de/docs/how-to/custom-request-and-route.md
```Python hl_lines="26" {!../../../docs_src/custom_request_and_route/tutorial003.py!} ``` In diesem Beispiel verwenden die *Pfadoperationen* unter dem `router` die benutzerdefinierte `TimedRoute`-Klasse und haben in der Response einen zusätzlichen `X-Response-Time`-Header mit der Zeit, die zum Generieren der Response benötigt wurde: ```Python hl_lines="13-20" {!../../../docs_src/custom_request_and_route/tutorial003.py!}
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Mar 30 18:18:23 GMT 2024 - 5.2K bytes - Viewed (0) -
docs/en/docs/how-to/custom-request-and-route.md
{!../../../docs_src/custom_request_and_route/tutorial002.py!} ``` If an exception occurs, the`Request` instance will still be in scope, so we can read and make use of the request body when handling the error: ```Python hl_lines="16-18" {!../../../docs_src/custom_request_and_route/tutorial002.py!} ``` ## Custom `APIRoute` class in a router You can also set the `route_class` parameter of an `APIRouter`:
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sun Mar 31 23:52:53 GMT 2024 - 4.4K bytes - Viewed (0) -
docs/em/docs/how-to/custom-request-and-route.md
```Python hl_lines="13 15" {!../../../docs_src/custom_request_and_route/tutorial002.py!} ``` 🚥 ⚠ 📉, `Request` 👐 🔜 ↔, 👥 💪 ✍ & ⚒ ⚙️ 📨 💪 🕐❔ 🚚 ❌: ```Python hl_lines="16-18" {!../../../docs_src/custom_request_and_route/tutorial002.py!} ``` ## 🛃 `APIRoute` 🎓 📻 👆 💪 ⚒ `route_class` 🔢 `APIRouter`: ```Python hl_lines="26" {!../../../docs_src/custom_request_and_route/tutorial003.py!} ```
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 3.6K bytes - Viewed (0)