Skip to content

Latest commit

 

History

History
51 lines (33 loc) · 1.25 KB

README.md

File metadata and controls

51 lines (33 loc) · 1.25 KB

starlette-gzip-request

starlette-gzip-request is a custom middleware for supporting HTTP requests compressed with Gzip in Starlette.

This package essentially aims to fill the need presented in encode/starlette#644.

  • Python 3.8+ support
  • Compatible with asyncio and trio backends

Installation

pip install starlette-gzip-request

Basic Usage

Starlette

from starlette.applications import Starlette
from starlette.middleware import Middleware
from starlette_gzip_request import GzipRequestMiddleware

middleware = [
    Middleware(GzipRequestMiddleware)
]

app = Starlette(routes=..., middleware=middleware)

FastAPI

starlette-gzip-request can also be used with FastAPI as follows:

from fastapi import FastAPI
from starlette_gzip_request import GzipRequestMiddleware

app = FastAPI()
app.add_middleware(GzipRequestMiddleware)

Contributing

If you'd like to contribute, please feel free to open a pull request (PR).

Please ensure that your PRs include test coverage to validate your changes. Thank you for helping improve starlette-gzip-request!

Authors