Skip to content

Commit

Permalink
fix(fromUrl): Better error message for redirects (#2978)
Browse files Browse the repository at this point in the history
When using SpEL functions like `*FromUrl` when the request requires auth and causes
a redirect response, we get a confusing "Not retrying" error message.
Make it a more descriptive error message that indicated where we are redirecting to (e.g. `login.asp`)
and state that it's not supported
  • Loading branch information
marchello2000 committed Jun 12, 2019
1 parent 7819d26 commit 50ecc92
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ public boolean retryRequest(
boolean shouldRetry =
(statusCode == 429 || RETRYABLE_500_HTTP_STATUS_CODES.contains(statusCode))
&& executionCount <= MAX_RETRIES;

if ((statusCode >= 300) && (statusCode <= 399)) {
throw new RetryRequestException(
String.format(
"Attempted redirect from %s to %s which is not supported",
currentReq.getURI(), response.getFirstHeader("LOCATION").getValue()));
}
if (!shouldRetry) {
throw new RetryRequestException(
String.format(
Expand Down

0 comments on commit 50ecc92

Please sign in to comment.