Logging just the headers in rest assured

We have seen earlier than we can log the entire req that we are sending to the server. But question is can we just log a part of the request than logging the entire request. We can do that as well.

So old way of doing it was this.

Response response = given().contentType(ContentType.JSON).header("X","Y").log().all().get();

But we can just log the headers for the request instead of logging everything as well. And in get we can pass “/12 ” to get 12th record or we can simply not put anything in get and put it like this Get() ,but if we don’t put anything in get we have to define our basePath like this to get the list of all students. RestAssured.basePath = "/student/list";

@Test
    
    public void getHeaderLogs(){
        
        
        RestAssured.baseURI = "http://localhost";
        RestAssured.port = 8080;
        RestAssured.basePath = "/student";
        
        Response response = given().header("X","Y").log().headers().get("/12");
        
        response.prettyPrint();
    
  }