Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add doc for compresslevel of the GZipMiddleware and use compresslevel=5 in the example #11412

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/en/docs/advanced/middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ The middleware will handle both standard and streaming responses.
The following arguments are supported:

* `minimum_size` - Do not GZip responses that are smaller than this minimum size in bytes. Defaults to `500`.
* `compresslevel` - Used during GZip compression. It is an integer ranging from 1 to 9. Defaults to `9`. A lower value results in faster compression but larger file sizes, while a higher value results in slower compression but smaller file sizes.

## Other middlewares

Expand Down
2 changes: 1 addition & 1 deletion docs_src/advanced_middleware/tutorial003.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

app = FastAPI()

app.add_middleware(GZipMiddleware, minimum_size=1000)
app.add_middleware(GZipMiddleware, minimum_size=1000, compresslevel=5)


@app.get("/")
Expand Down