Make route limiting optional #14
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new
limitedparameter to both theadd_unauthenticated_routeandadd_authenticated_routemethods intemplate_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 thelimitedflag.Route rate limiting control:
limitedboolean parameter (defaulting toTrue) toadd_unauthenticated_routeandadd_authenticated_routeintemplate_server.py, allowing routes to be registered without rate limiting whenlimited=False. The route handler is wrapped with the rate limiter only iflimitedisTrue./healthendpoint registration to uselimited=False, ensuring it is not rate limited.Testing and mock endpoints:
limited=Falseoption. [1] [2]limitedparameter 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.