By default Rest-Assured is printing too much debug data to the console.
Can anyone tell how can I disable it?
You can tell RestAssured what you want to log like this:
RestAssured
.given()
.log().ifValidationFails(LogDetail.ALL, true)
.body(body)
.post("URL")
.then()
.log().ifValidationFails(LogDetail.ALL, true)
.extract()
.jsonPath()
.getObject("body", DTO.class)
and if something go wrong it print request/response info to console.
You can choose which part of request/response to log by specify value from io.restassured.filter.log.LogDetail as ifValidationFails() first param.
If you want log request or response all the time use this
RestAssured
.given()
.log().<all|body|headers|etc>()
.body(body)
.post("URL")
.then()
.log().<all|body|headers|etc>()
.extract()
.jsonPath()
.getObject("body", DTO.class)
log() after given() will config request logging
log() after then() will config response logging
You can find more helpful info here https://github.com/rest-assured/rest-assured/wiki/Usage#logging
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With