Hi,
I have an use case that require to attache on every post some variables.
If I create the Map directly inline, it works well as expected :
.exec(
http(“TemplateBody”)
.post("/someurl")
.fileBody(“mybody.json”,
Map(
"key1" → “${val1}”,
"key2" → "${val2}"
)
)
)
As I have to reuse exactly this map (or later with more value appended to this map), I’m trying to extract the creation of the map.
Naively, I tried this but with no success :
val helloMap : Map(
"key1" → “${val1}”,
"key2" → "${val2}"
)
//…
.exec(
http(“TemplateBody”)
.post("/someurl")
.fileBody(“mybody.json”,
myMap
)
)
Error is :
found : scala.collection.immutable.Map[java.lang.String,java.lang.String]
required: Map[String,com.excilys.ebi.gatling.core.session.Session => String]
Then I tried different thing to make it working (change signature, try to pass the session, …) but nothing was looking good.
Maybe someone can help on this?
Final goal is to avoid to copy/paste everywhere the Map(…) for every call.
Bonus question : is there a concept of ‘hook’ in Gatling, like “before every http request do…” ?
Thank you,
Maxence