Hi
I have a request where 3 header parameters need to be generated dynamically.
Example: timestamp, userid , token
token is calculated based on userid and timestamp.
val getUserScenario = scenario(“Get User”)
.feed(customFeeder)
.exec(
http(“Get User”)
.get("/user")
.header(“timestamp”,"${timeStampStr}")
.header(“userid”, “${userid}”)
.header(“token”, “${token}”)
.check(status.is(200))
I am trying to use custom Feeder for this by over riding default feeder
object customFeed {
val customFeeder = new Feeder[String] {
override def hasNext = true
override def next: Map[String, String] = {
val sdf = new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss.SSS”)
sdf.setTimeZone(TimeZone.getTimeZone(“UTC”))
val strUserid = abs(ThreadLocalRandom.current().nextLong(10000000000L)).toString
val timeStamp = DateTime.now()
val now = new Date(timeStamp.getMillis())
val timeStampStr = sdf.format(now)
…
…
…
…
val timeStampStr = sdf.format(now)
val strUserid = abs(ThreadLocalRandom.current().nextLong(10000000000L)).toString
val token : String = … Calculated by complex math…based on timestamp and userid
Map(“timeStampStr” → timeStampStr)
Map(“token”-> token)
Map(“userid” → strUserid**)**
}
}
When i try to use this in get Call mentioned above, it only recognizes the last parameter in Map. That is Map(“upmId” → strUpmId). It is not recognizing timStampStr attribute and hashedToken attribute.
Please help me with is scenario.
Regards,
Santhosh