conditional saving of Response data in http

I want to save the response body if my logger is in DEGUG state, I’m attempting to do this :
I want to save the response if my logger.isDebugEnabled is TRUE ) but it doesn’t compile because if/doIf is not a method in http . How do I achieve this ?


exec(
 http("LandingPage")
 .get("/login") ///c11/v1603.116/729542582413511/login

 .header("Accept","text/plain; charset=utf-8")
 .header("Upgrade-Insecure-Requests","1")
 .check(status.in(200,302))
 .check(responseTimeInMillis.saveAs("execLatency"))
/* I want to save the response if my logger.isDebugEnabled is TRUE ) but it doesent compile because if/doIf is not a method in http . How do I achieve this ? */
 .if(logger.isDebugEnabled){
 .check(bodyString.saveAs("qboLandingPageValidPayload")))
 }
 .check(regex("name=\"parentID\" value=\"(.*?)\"><input id=").saveAs("parentid"))
 //.check(headerRegex("Set-Cookie", "qbo.dtc.parentid=([0-9]*)").saveAs("parentid"))
)