correctly handle 0 as a Retry-Header value (#1671)

This commit is contained in:
Athou
2025-02-05 07:45:07 +01:00
parent 6e65ed49e9
commit 8edd6a1e2d
3 changed files with 14 additions and 3 deletions

View File

@@ -9,7 +9,6 @@ import java.time.InstantSource;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import org.apache.commons.lang3.StringUtils;
@@ -111,7 +110,7 @@ public class HttpGetter {
}
int code = response.getCode();
if (Set.of(HttpStatus.SC_TOO_MANY_REQUESTS, HttpStatus.SC_SERVICE_UNAVAILABLE).contains(code) && response.getRetryAfter() != null) {
if (code == HttpStatus.SC_TOO_MANY_REQUESTS || code == HttpStatus.SC_SERVICE_UNAVAILABLE && response.getRetryAfter() != null) {
throw new TooManyRequestsException(response.getRetryAfter());
}