title: Null response entity with 307 status code in Rest Template
body: <p>I am trying to use Spring <code>RestTemplateBuilder</code> to call a REST web service and POST data. Here is the sample of my code.</p>
  
  <pre><code>public HttpHeaders getHttpHeaders() {
      HttpHeaders requestHeaders = new HttpHeaders();
      requestHeaders.add("Authorization", "Basic " + authToken);
      requestHeaders.add("Content-Type", "application/json");
      return requestHeaders;
  }
  
  public ResponseJson getData(RequestJson requestJson) {
      HttpEntity&lt;RequestJson&gt; entity = new HttpEntity&lt;&gt;(requestJson, getHttpHeaders());
      ResponseEntity&lt;ResponseJson&gt; result = restTemplateBuilder.build().postForEntity(PostUrl, entity, ResponseJson.class);
  }
  </code></pre>
  
  <p>When I debug this, it gives <strong>status=307</strong> and <strong>body=null</strong> for <strong>ResponseEntity</strong>. But when I call the PostUrl directly with a request body, it creates data with <strong>201 status code</strong>.</p>
  
  <p>May I know how, to figure out this 307 status and why I am getting null response ?</p>