How to blacklist headers in Rest Assured?
As of REST Assured 4.2.0 it's possible to blacklist headers so that they are not shown in the request or response log. Instead the header value will be replaced with [ BLACKLISTED].
Request
given()
.config(RestAssured.config()
.logConfig(LogConfig.logConfig().blacklistHeader("Accept"))
.log().headers()
Output
Accept=[ BLACKLISTED ]
Response
given()
.config(RestAssured.config()
.logConfig(LogConfig.logConfig().blacklistHeader("set-cookie"))
then()
.log().headers()
Output
set-cookie: [ BLACKLISTED ]