Modify body after using Expression language

Hi Gatling team,

Here is my issue:

I use Gatling Expression Language with a body that I have in a file. The problem is that I need to encrypt it before sending it. Of course I want it to be encrypted AFTER Gatling replaces ${} values !

The SignatureCalculator doesn’t expose the body as a mutable variable inside the request and I don’t think there’s an easy way to change it (and I don’t really want to use gatling internals).

The only solution I got so far is :

val resolvedBody: Expression[String] = session => {
val newSession: Session = session.set(“foo”, “bar”).set(“fooz”, “baz”)
val myString = “${foo} and ${fooz}”.el[String]

val request = exec(http(“Request name”)

(of course, the session will be filled with a feeder, and the myString will be the file content)

The problem with this solution is that I have to load all the files myself as string before the simulation.

Do you have an idea to perform what I want in a better way ?

Thanks in advance ! :smiley:

I don’t know if there is a better solution or if mine is “acceptable” ! Anyone faced a similar use case ?


okay ! thank you ! :slight_smile: