Can EL be used inside Session getting methods?

TLDR: It seems that Gatling EL cannot be used within session.getX() methods. Is that correct?

Example. Assume I made a request and recieved a fruit object like

    "color": "green",
    "name": "pear"

Lets assume I save that object as a Map to the session as fruit

I would now like to extract the color property of my fruit map. Ahah! Gatling provides El Syntax "#{}" for Java Maps!

String color = session.getString("#{fruit.color}"));

An exception is thrown
NoSuchElementException: key not found: fruit.color

To me this indicates that Gatling EL does not work like I would expect based on what the documentation is telling me. Does this mean that its expected that I use session.getMap("fruit") to get my fruit object, then pull out the color property that way?
If not, then what is the expected way to get properties from an object saved to a session?


Within an expression (a Session to Session lambda), you cannot use expression language (expression inception).

If you need the String for the sake to have a String variable, then you’ll have to

String myColor = (String) session.getMap("fruit").get("color");

But usually, you need session value to use them in body for other requests where Gatling EL is available.

exec(http("Tell my friend the color of the fruit").post("/messages").body(StringBody("{\"to\": #{myFriendId}, \"what\": \"My fruit is #{fruit.color}\"}"));

Does that help?