- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 36 for GZIP (0.12 sec)
-
fastapi/middleware/gzip.py
from starlette.middleware.gzip import GZipMiddleware as GZipMiddleware # noqa...
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sun Dec 20 18:50:00 GMT 2020 - 79 bytes - Viewed (0) -
docs/zh/docs/advanced/custom-request-and-route.md
* 把 <a href="https://msgpack.org/index.html" class="external-link" target="_blank">`msgpack`</a> 等非 JSON 请求体转换为 JSON * 解压 gzip 压缩的请求体 * 自动记录所有请求体的日志 ## 处理自定义请求体编码 下面学习如何使用自定义 `Request` 子类压缩 gizp 请求。 并在自定义请求的类中使用 `APIRoute` 子类。 ### 创建自定义 `GzipRequest` 类 !!! tip "提示" 本例只是为了说明 `GzipRequest` 类如何运作。如需 Gzip 支持,请使用 [`GzipMiddleware`](./middleware.md#gzipmiddleware){.internal-link target=_blank}。
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/en/docs/advanced/middleware.md
## `GZipMiddleware` Handles GZip responses for any request that includes `"gzip"` in the `Accept-Encoding` header. The middleware will handle both standard and streaming responses. ```Python hl_lines="2 6" {!../../../docs_src/advanced_middleware/tutorial003.py!} ``` The following arguments are supported:
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/how-to/custom-request-and-route.md
* Decompressing gzip-compressed request bodies. * Automatically logging all request bodies. ## Handling custom request body encodings Let's see how to make use of a custom `Request` subclass to decompress gzip requests. And an `APIRoute` subclass to use that custom request class. ### Create a custom `GzipRequest` class
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) -
tests/test_tutorial/test_advanced_middleware/test_tutorial003.py
client = TestClient(app) def test_middleware(): response = client.get("/large", headers={"accept-encoding": "gzip"}) assert response.status_code == 200, response.text assert response.text == "x" * 4000 assert response.headers["Content-Encoding"] == "gzip" assert int(response.headers["Content-Length"]) < 4000 response = client.get("/")
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Thu Jul 09 18:06:12 GMT 2020 - 665 bytes - Viewed (0) -
tests/test_tutorial/test_custom_request_and_route/test_tutorial001.py
import gzip import json import pytest from fastapi import Request from fastapi.testclient import TestClient from docs_src.custom_request_and_route.tutorial001 import app @app.get("/check-class") async def check_gzip_request(request: Request): return {"request_class": type(request).__name__} client = TestClient(app) @pytest.mark.parametrize("compress", [True, False]) def test_gzip_request(compress):
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Sun Nov 13 14:26:09 GMT 2022 - 886 bytes - Viewed (0) -
docs_src/custom_request_and_route/tutorial001.py
import gzip from typing import Callable, List from fastapi import Body, FastAPI, Request, Response 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
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri May 13 23:38:22 GMT 2022 - 973 bytes - Viewed (0) -
docs/de/docs/how-to/custom-request-and-route.md
* Dekomprimierung gzip-komprimierter Requestbodys. * Automatisches Loggen aller Requestbodys. ## Handhaben von benutzerdefinierten Requestbody-Kodierungen Sehen wir uns an, wie Sie eine benutzerdefinierte `Request`-Unterklasse verwenden, um gzip-Requests zu dekomprimieren.
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/reference/middleware.md
It can be imported from `fastapi`: ```python from fastapi.middleware.cors import CORSMiddleware ``` ::: fastapi.middleware.gzip.GZipMiddleware It can be imported from `fastapi`: ```python from fastapi.middleware.gzip import GZipMiddleware ``` ::: fastapi.middleware.httpsredirect.HTTPSRedirectMiddleware It can be imported from `fastapi`: ```python
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 991 bytes - Viewed (0) -
docs/de/docs/reference/middleware.md
Kann von `fastapi` importiert werden: ```python from fastapi.middleware.cors import CORSMiddleware ``` ::: fastapi.middleware.gzip.GZipMiddleware Kann von `fastapi` importiert werden: ```python from fastapi.middleware.gzip import GZipMiddleware ``` ::: fastapi.middleware.httpsredirect.HTTPSRedirectMiddleware Kann von `fastapi` importiert werden: ```python
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Mar 30 18:15:39 GMT 2024 - 1001 bytes - Viewed (0)