title: Spring-boot Resttemplate response.body is null while interceptor clearly shows body
body: <p>With Spring-boot 1.5.10.RELEASE, I am getting response.body as null. </p>
  
  <p>Here is how I am using RestTemplate</p>
  
  <pre><code>RestTemplate restTemplate = new RestTemplate();
      List&lt;ClientHttpRequestInterceptor&gt; interceptors = new ArrayList&lt;&gt;();
      interceptors.add(new LoggingRequestInterceptor());
      restTemplate.setInterceptors(interceptors);
  
      String url = "http://someurl/Commands";
  
      MultiValueMap&lt;String, String&gt; params = new LinkedMultiValueMap&lt;&gt;();
      params.add("cmd", "{\"operation\":\"getSomeDetails\"}}");
  
      HttpHeaders headers = new HttpHeaders();
      headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
      HttpEntity&lt;MultiValueMap&lt;String, String&gt;&gt; request = new HttpEntity&lt;&gt;(params, headers);
  
      ResponseEntity&lt;String&gt; response = restTemplate.postForEntity(url, request, String.class);
  
      System.out.println("This is always null: " + response.getBody());
  </code></pre>
  
  <p>While above program always prints null, 
  following interceptor prints valid response body </p>
  
  <pre><code>public class LoggingRequestInterceptor implements ClientHttpRequestInterceptor {
  
  final static Logger log = LoggerFactory.getLogger(LoggingRequestInterceptor.class);
  
  @Override
  public ClientHttpResponse intercept(final HttpRequest request, final byte[] body,
                                      final ClientHttpRequestExecution execution) throws IOException {
      traceRequest(request, body);
      ClientHttpResponse response = execution.execute(request, body);
      traceResponse(response);
      return response;
  }
  
  
  private void traceResponse(ClientHttpResponse response) throws IOException {
      StringBuilder inputStringBuilder = new StringBuilder();
      BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getBody(), "UTF-8"));
      String line = bufferedReader.readLine();
      while (line != null) {
          inputStringBuilder.append(line);
          inputStringBuilder.append('\n');
          line = bufferedReader.readLine();
      }
      log.debug("============================response begin==========================================");
      log.debug("Status code  : {}", response.getStatusCode());
      log.debug("Status text  : {}", response.getStatusText());
      log.debug("Headers      : {}", response.getHeaders());
      log.debug("Response body: {}", inputStringBuilder.toString());
      log.debug("=======================response end=================================================");
  }
  </code></pre>
  
  <p>}</p>