dynamic header names

Trying to figure out how to set a dynamic header name and header value. I’ve tried using session variables without luck.

Tried this:

You can’t. Header names are static.

I have environments that use different sso header names (ex: sso-dev, sso-test). I would like to create a test that can set the correct header name basic on config passed in. I’m tried to use a csv data feeder which included the header name.

Any suggestions on how this could be accomplished?

A system property, a config value, whatever.
This value is static for a given run and not user dependant, why would you want to use a feeder for this?

I’m new to Gatling and scala. I have some basic tests running that use feeders, so I was trying to leverage what I’ve done.

I’ve been able to leaverage a global variable as a header name:

var ssoHdrName = “xxx”


Is there a way to change the value of the variable in a .exec statement, for example:

.exec(session => {
ssoHdrName = session(“env_ssoHdrName”).as[String]

This runs but the ssoHdrName global variable isn’t updated.

You can’t have user scoped header names, period.

// find a way to set this System property when launching Gatling, depending on how you launch it
val ssoHdrName = System.getProperty(“ssoHdrName”)