javagatling

How do I set a session attribute that includes an EL expression in Gatling?


I have a POST request which might have some different properties depending on my scenario. I'm trying to exec(session -> session.set("payload", ...)) to store the appropriate template for the request before the actual call to post().body(StringBody("#{payload}")) but then any EL tags in the template aren't being replaced.

I'm guessing StringBody() doesn't process EL tags inside the value recovered by an EL tag.

How could I have a variable body for my post and still have the EL tags in it processed?


Solution

  • Use ElFileBody instead StringBody

    https://docs.gatling.io/reference/script/protocols/http/request/#elfilebody