code: private static boolean isRequestRewriteNeeded(HttpMessage message) {
          int statusCode = message.getResponseHeader().getStatusCode();
          String method = message.getRequestHeader().getMethod();
          if (statusCode == 301 || statusCode == 302) {
              return HttpRequestHeader.POST.equalsIgnoreCase(method);
          }
          return statusCode == 303
                  && !(HttpRequestHeader.GET.equalsIgnoreCase(method) || HttpRequestHeader.HEAD.equalsIgnoreCase(method));
      }
docs: Tells whether or not the (original) request of the redirection, should be rewritten.
  <p>
  For status codes 301 and 302 the request should be changed from POST to GET when following redirections, for status code
  303 it should be changed to GET for all methods except GET/HEAD (mimicking the behaviour of browsers, which per
  <a href="https://tools.ietf.org/html/rfc7231#section-6.4">RFC 7231, Section 6.4</a> is now OK).
  
  @param message the message with the redirection.
  @return {@code true} if the request should be rewritten, {@code false} otherwise
  @see #isRedirectionNeeded(int)