How can I dynamically build an http().get() url string using class parameter values of an object stored in the session

Part of the main html response is a json blob. Using the check() I have saved the json blob as a string in the session. I then deserialized that json blob into a class/object, which I then stored in the session. Now I need to build a url for a subsequent http().get(), using a value within the object from the deserialized json.

How do I build the proper url in .resources(http().get())?
`
exec(http(“Go Home”)
.get("/home")
.check(regex(“my awesome regex to extract json”).saveAs(“jsonBlob”))
.resources(http(“Home CSS”)
.get("/css/home_${state.version}.css")) // ← this is the part I need help with
)
.exec { session =>
val state:SiteState = SiteState.parse(session.get(“jsonBlob”).as[String])
session.set(“state”, state)
}

`

Here is the code for SiteState, if it matters
`
import com.google.gson.Gson

case class SiteState() {
var version:String = “”
var otherValuableData:Long = -1L
}

object SiteState {
private val gson = new Gson

def parse(data:String): SiteState = {
gson.fromJson(data, classOf[SiteState])
}
}
`

Thanks!

Here’s a more complete code blob for the simulation:

`
import io.gatling.core.Predef._
import io.gatling.core.structure.ScenarioBuilder
import io.gatling.http.Predef._
import io.gatling.http.protocol.HttpProtocolBuilder

class MyAwesomeSimulation extends Simulation {

val httpProtocol:HttpProtocolBuilder = http
.baseURL(“http://my.awesome.site”)
.inferHtmlResources()
.acceptHeader("/")
.acceptEncodingHeader(“gzip, deflate”)
.acceptLanguageHeader(“en-US,en;q=0.5”)
.userAgentHeader(“Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36”)

val scn:ScenarioBuilder = scenario(“MyAwesomeSimulation”)
.exec(http(“Go Home”)
.get("/home")
.check(regex(“my awesome regex to extract json”).saveAs(“jsonBlob”))
.resources(http(“Home CSS”)
.get("/css/home_${state.version}.css")) // ← this is the part I need help with
)
.exec { session =>
val state:SiteState = SiteState.parse(session.get(“jsonBlob”).as[String])
session.set(“state”, state)
}

setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)
}
`