title: HttpClient read response body in java 11
body: <p>I created a rest API for login using Spring Boot, but in client(Java) I am not able to see response body.    </p>
  
  <pre><code>   HttpClient client = HttpClient.newHttpClient();
          HttpRequest request = HttpRequest.newBuilder()
                  .uri(URI.create("http://localhost:9091/student/" + response))
                  .GET()
                  .header("Content-Type", "application/json")
                  .build();
  
          HttpResponse&lt;String&gt; response1 =
                  client.send(request, HttpResponse.BodyHandlers.ofString());
  
          System.out.println("res: " + response1.body());
  </code></pre>
  
  <p>My function from controller is:</p>
  
  <pre><code>@RequestMapping(value = RequestPath.GET_STUDENT_BY_ID, method = RequestMethod.GET)
  public ResponseEntity getById(@PathVariable UUID id){
      StudentEntity res = studentService.findById(id);
      return ResponseEntity.status(HttpStatus.OK).body(res);
  }
  </code></pre>
  
  <p>I tested my API using postman and I am able to  see the response body in json format.</p>
  
  <p>Is there another way to get the response body using Java Http client?</p>