code: private static String getFinalResponseUrl(
              final HttpClientContext context,
              final String candidateUrl) {
          List<URI> redirectLocations = context.getRedirectLocations();
          if (redirectLocations != null) {
              return redirectLocations.get(redirectLocations.size() - 1).toString();
          }
  
          return candidateUrl;
      }
docs: If the HTTP HEAD request was redirected, it returns the final redirected URL. If not, it
  returns the original URL of the candidate.
  
  @param context      the current HTTP client context
  @param candidateUrl the URL of the candidate
  
  @return the final response URL