title: Gatling Conditional on Response Body
body: <p>I am currently using Gatling and I have a scenario whereby I perform a number of GET requests and depending on the body of the responses I would like to perform a different scenario.</p>
  
  <p>I have this at the moment that doesn't appear to work as expected -</p>
  
  <pre><code>  val repeatSpin = scenario("repeatScenario1").repeat(10) {
      exec(
        scenario1
      )
      .doIf(bodyString =&gt; bodyString.equals("&lt;SwitchEvent/&gt;")){
        exec(scenario2)
      }
    }
  </code></pre>
  
  <p>What am I doing wrong?</p>