-
Notifications
You must be signed in to change notification settings - Fork 19
feat: Add rate limiting middleware #140
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
feat: Add rate limiting middleware #140
Conversation
- Implement token bucket and sliding window rate limiting algorithms - Add configurable middleware with Express.js-like API - Include comprehensive test coverage (18 tests passing) - Add examples and documentation - Support custom key generation, skip functions, and headers - Compatible with existing Pharaoh middleware system
- Fix import path and API usage for rate limiting example - Add proper dependency configuration in pubspec.yaml - Create comprehensive test script demonstrating all features - Verify rate limiting works with token bucket and sliding window - Test custom key generation, skip functionality, and headers
This commit applies consistent formatting, improves code readability, and fixes minor whitespace issues across rate limiting middleware, algorithms, and example/test files. No functional changes were made; the update is purely stylistic to enhance maintainability.
- Fix dart analyze warning for unused 'body' variable - Consume response body without storing in unused variable - All analysis checks now pass
|
Looks good to me. @heyOnuoha Worth adding actual http tests that verify the rate limiting in action. |
Got it @codekeyz, Will add that in |
- Create comprehensive HTTP tests that verify rate limiting in action - Test 429 responses, rate limit headers, and middleware behavior - Address maintainer feedback for actual HTTP verification - Include tests for custom key generation and skip functionality - All existing unit tests continue to pass (18 tests)
- Create focused HTTP test that verifies rate limiting in action - Test 429 responses, rate limit headers, and middleware behavior - Use Spookie framework following Pharaoh testing patterns - Remove complex HTTP client test attempts - All 22 tests now pass including HTTP integration tests - Addresses maintainer feedback for actual HTTP verification
Added new code coverage JSON reports for multiple test files across pharaoh, pharaoh_basic_auth, pharaoh_jwt_auth, pharaoh_rate_limit, spanner, and spookie packages. Removed the unused test_rate_limiting.dart from pharaoh_examples and updated rate_limit_http_test.dart in pharaoh_rate_limit.
codekeyz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you added some new files by mistake **.dart.vm.json
Yes, that file was generated by the coverate script |
You'll need to remove them. We don't need them aded to the repo. |
Alright got it, I'll take them out |
Deleted multiple .vm.json files containing test coverage data from various package directories. This cleanup likely prepares for regeneration of coverage reports or reduces repository size by removing generated artifacts.
|
Looks good to me, I'll merge now ✅ |
Description
This PR adds a Rate Limiting Middleware to pharaoh middlewares.
Type of Change