Skip to content

feat: add per-endpoint rate limiting middleware - #48

Open
Iaguiz wants to merge 2 commits into
iklobato:masterfrom
Iaguiz:master
Open

Iaguiz wants to merge 2 commits into
iklobato:masterfrom
Iaguiz:master

Conversation

@Iaguiz

@Iaguiz Iaguiz commented Sep 21, 2026

Copy link
Copy Markdown

Adds EndpointRateLimitMiddleware for configurable per-endpoint rate limiting.

How to use:

class BookEndpoint(RestEndpoint, HttpMethod.GET):
    title: str = Field(min_length=1)

    class Meta:
        rate_limit = {"requests": 3, "window": 60}

Returns 429 Too Many Requests with X-RateLimit-* headers when the limit is exceeded.

Includes example (examples/19_rate_limit.py) and tests (tests/test_rate_limit_middleware.py).

To test:
pytest tests/test_rate_limit_middleware.py -v

Iago Homsi and others added 2 commits September 21, 2026 15:49
- Add EndpointRateLimitMiddleware to enforce rate limits per endpoint
- Configure rate limits via endpoint Meta.rate_limit = {requests, window}
- Add X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers
- Return 429 when limit exceeded
- Add example (19_rate_limit.py) and tests
feature: add per-endpoint rate limiting middleware

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant