Skip to content
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

Reject request that exceeded limit with TooManyRequestsRejection #5

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Conversation

unoexperto
Copy link

Reject request that exceeded limit with TooManyRequestsRejection rejection instead of responding with complete directive. Rationale is to allow developer to respond with body he/she wants (in custom rejection handler) instead of hardcoding text-only response.

Downside of this method is that there is no default handler for this rejection similarly to handler for TooManyRangesRejection for example. So if library user doesn't implement handler for TooManyRequestsRejection http client will get 500 error.

For example in my case all rejections are wrapped into json response that mobile client understands.

…jection instead of responding with complete directive.
@yeghishe
Copy link
Contributor

@unoexperto The idea is interesting. I do think that the default behavior should be for library to handle it and make it as transparent to developer as possible. On other end I'm all for allowing dev to have control when needed. There is ThrottleSettings as an implicit parameter for the method you're trying to change. I would say we can add more settings for this kind of things.

There is also ConfigMetricThrottleSettings.scala where the settings can be injected from typesafe config.

Let me know what you think

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