-
Notifications
You must be signed in to change notification settings - Fork 29
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
Allow request retry with custom HTTP codes (like 429 - Too Many Requests) and implement delay retry #3
Comments
…quest with specified http status code.
Hi @tciuro, Currently
Default implementation set This is an example which works with the default shared let myValidator = HTTPDefaultValidator()
myValidator.retriableHTTPStatusCodes = [.tooManyRequests: 5] // wait 5 seconds for HTTP 429
HTTPClient.shared.validators = [myValidator]
request.maxRetries = 2 // you must set a retry > 1 in order to get it works
request.onRawResponse { response in
// do something
}
request.run() It will be part of the 0.9.16 version. |
Support Question
When a service returns
HTTP 429 Too Many Requests
, I was expecting RealHTTP to trigger the retry mechanism. Alas, this is not what I see. I get anHTTP 429
error right away without any retries. Shouldn't this scenario be handled by RealHTTP? 🤔The text was updated successfully, but these errors were encountered: