Skip to content

Conversation

@javidahmed64592
Copy link
Owner

This pull request introduces a new limited parameter to both the add_unauthenticated_route and add_authenticated_route methods in template_server.py, allowing API routes to opt out of rate limiting. The update is reflected in the server's health check route and is thoroughly tested with new unit tests and mock endpoints to verify the correct application of rate limiting based on the limited flag.

Route rate limiting control:

  • Added a limited boolean parameter (defaulting to True) to add_unauthenticated_route and add_authenticated_route in template_server.py, allowing routes to be registered without rate limiting when limited=False. The route handler is wrapped with the rate limiter only if limited is True.
  • Updated the /health endpoint registration to use limited=False, ensuring it is not rate limited.

Testing and mock endpoints:

  • Added mock unlimited (not rate-limited) protected and unprotected endpoints to the mock server in the test suite, using the new limited=False option. [1] [2]
  • Added tests to verify that the limited parameter correctly controls the application of the rate limiter for both authenticated and unauthenticated routes, checking the presence of the limiter wrapper and authentication dependencies as appropriate.
  • Updated the expected endpoints in the route setup test to include the new unlimited endpoints.

@javidahmed64592 javidahmed64592 merged commit ff04d4e into main Dec 13, 2025
9 checks passed
@javidahmed64592 javidahmed64592 deleted the make-route-limiting-optional branch December 13, 2025 00:28
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.

2 participants