Condition on response body regex

Hi all,

First of all, Gatling is great tool. Despite really understanding much Scala, I really like it. I’m struggling with conditions a bit. I’m trying to create scenario for testing JIRA. JIRA server uses websudo, for certain administration pages you need to provide credentials. After that, you have 10 minutes rolling timeout to do your stuff and than you’ll be prompted for credentials again. Is there a way how could I create condition, which would decide which page to load further/or put in credentials if needed, based on current web page body? In case websudo page is encountered, current location is not changed, just page body. I currently have this working through session variable, but since I’ll be navigating to multiple sites I don’t want to create new and new variables. Thanks.

.exec(http("ADMIN - system info") .get("/secure/admin/ViewSystemInfo.jspa") .headers(headers_0) .check( .check(regex("""You have requested access to an administrative function in JIRA and are required to validate your credentials below.""").optional.saveAs("websudo"))) .doIf(session => session.contains("websudo")) { exec(http("websudo") .post("/secure/admin/WebSudoAuthenticate.jspa") .headers(headers_0) .formParam("webSudoPassword", "0000") .formParam("webSudoDestination", "/secure/admin/ViewSystemInfo.jspa") .formParam("webSudoIsPost", "false") .check( .check(currentLocationRegex("/secure/admin/ViewSystemInfo.jspa")) ) } .pause(1)