Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/razcrimson/starlette-gzip-request
A custom ASGI middleware for starlette to handle GZipped HTTP Requests
https://github.com/razcrimson/starlette-gzip-request
asgi fastapi starlette starlette-middleware
Last synced: 2 months ago
JSON representation
A custom ASGI middleware for starlette to handle GZipped HTTP Requests
- Host: GitHub
- URL: https://github.com/razcrimson/starlette-gzip-request
- Owner: RazCrimson
- License: bsd-3-clause
- Created: 2024-06-30T13:16:21.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-06-30T17:47:13.000Z (6 months ago)
- Last Synced: 2024-10-06T03:57:37.134Z (3 months ago)
- Topics: asgi, fastapi, starlette, starlette-middleware
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# starlette-gzip-request
**starlette-gzip-request** is a custom middleware for supporting HTTP requests compressed with Gzip in [Starlette](https://www.starlette.io).
This package essentially aims to fill the need presented in https://github.com/encode/starlette/issues/644.
- Python 3.8+ support
- Compatible with `asyncio` and `trio` backends## Installation
```sh
pip install starlette-gzip-request
```## Basic Usage
### Starlette
```py
from starlette.applications import Starlette
from starlette.middleware import Middleware
from starlette_gzip_request import GzipRequestMiddlewaremiddleware = [
Middleware(GzipRequestMiddleware)
]app = Starlette(routes=..., middleware=middleware)
```### FastAPI
`starlette-gzip-request` can also be used with [FastAPI](https://fastapi.tiangolo.com) as follows:
```py
from fastapi import FastAPI
from starlette_gzip_request import GzipRequestMiddlewareapp = 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
- Bharath Vignesh J K - [@RazCrimson](https://github.com/RazCrimson)