- Sort Score
- Result 10 results
- Languages All
Results 1 - 5 of 5 for example (0.28 sec)
-
docs/zh/docs/advanced/middleware.md
## `TrustedHostMiddleware` 强制所有传入请求都必须正确设置 `Host` 请求头,以防 HTTP 主机头攻击。 ```Python hl_lines="2 6-8" {!../../../docs_src/advanced_middleware/tutorial002.py!} ``` 支持以下参数: * `allowed_hosts` - 允许的域名(主机名)列表。`*.example.com` 等通配符域名可以匹配子域名,或使用 `allowed_hosts=["*"]` 允许任意主机名,或省略中间件。 如果传入的请求没有通过验证,则发送 `400` 响应。 ## `GZipMiddleware` 处理 `Accept-Encoding` 请求头中包含 `gzip` 请求的 GZip 响应。 中间件会处理标准响应与流响应。 ```Python hl_lines="2 6"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Mar 30 22:44:27 GMT 2024 - 3.6K bytes - Viewed (0) -
docs/de/docs/advanced/middleware.md
{!../../../docs_src/advanced_middleware/tutorial002.py!} ``` Die folgenden Argumente werden unterstützt: * `allowed_hosts` – Eine Liste von Domain-Namen, die als Hostnamen zulässig sein sollten. Wildcard-Domains wie `*.example.com` werden unterstützt, um Subdomains zu matchen. Um jeden Hostnamen zu erlauben, verwenden Sie entweder `allowed_hosts=["*"]` oder lassen Sie diese Middleware weg.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Mar 30 20:18:15 GMT 2024 - 4.4K bytes - Viewed (0) -
docs/em/docs/advanced/middleware.md
🛠️ 👈 🌐 📨 📨 ✔️ ☑ ⚒ `Host` 🎚, ✔ 💂♂ 🛡 🇺🇸🔍 🦠 🎚 👊. ```Python hl_lines="2 6-8" {!../../../docs_src/advanced_middleware/tutorial002.py!} ``` 📄 ❌ 🐕🦺: * `allowed_hosts` - 📇 🆔 📛 👈 🔜 ✔ 📛. 🃏 🆔 ✅ `*.example.com` 🐕🦺 🎀 📁. ✔ 🙆 📛 👯♂️ ⚙️ `allowed_hosts=["*"]` ⚖️ 🚫 🛠️. 🚥 📨 📨 🔨 🚫 ✔ ☑ ⤴️ `400` 📨 🔜 📨. ## `GZipMiddleware` 🍵 🗜 📨 🙆 📨 👈 🔌 `"gzip"` `Accept-Encoding` 🎚. 🛠️ 🔜 🍵 👯♂️ 🐩 & 🎥 📨.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Apr 01 09:26:04 GMT 2023 - 3.3K bytes - Viewed (0) -
docs/en/docs/advanced/middleware.md
But FastAPI (actually Starlette) provides a simpler way to do it that makes sure that the internal middlewares to handle server errors and custom exception handlers work properly. For that, you use `app.add_middleware()` (as in the example for CORS). ```Python from fastapi import FastAPI from unicorn import UnicornMiddleware app = FastAPI() app.add_middleware(UnicornMiddleware, some_config="rainbow") ```
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 10 18:27:10 GMT 2023 - 4K bytes - Viewed (0) -
docs/en/docs/tutorial/middleware.md
### Before and after the `response` You can add code to be run with the `request`, before any *path operation* receives it. And also after the `response` is generated, before returning it. For example, you could add a custom header `X-Process-Time` containing the time in seconds that it took to process the request and generate a response: ```Python hl_lines="10 12-13" {!../../../docs_src/middleware/tutorial001.py!} ```
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Jan 11 16:31:18 GMT 2024 - 2.9K bytes - Viewed (0)