Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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 GzipRequestMiddleware

middleware = [
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 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
- Bharath Vignesh J K - [@RazCrimson](https://github.com/RazCrimson)