selva4
February 3, 2023, 10:54am
1
basically the variable “C_Login” will have the map values of headers and trying on how to session MAP variable to headers.
.exec(_.setAll(Map("C_login" -> Login.loginSessionVariables.get("login_matchProxyPerson").get)))
// .exec { session =>
// val newSession = session.setall("foo", "bar")
// newSession
// }
.feed(accountIdPayloadfeeder)
.pace(gatlingVariableConfig.pace_time)
.exec(
http("T01_ReactMatchProxyPerson")
.post("/v1/match/person")
.headers( session => session("C_login").as[String])
@slandelle could you please suggest on how it could be implemented differently.
here is the details, that you are looking
the following lines of codes are in the Login.scala file
var temp=MapCharSequence,String
temp+= “x-ziaccesstoken” → session(“C_ziaccesstoken”).as[String]
temp+= “x-ziid” → jwt.getclaims.get(“ziid”)
temp+= “x-zisession” → jwt.getclaims.get(“zisession”)
loginSessionVariables+= name → temp
selva4
February 3, 2023, 4:59pm
3
slandelle:
.exec(_.set("C_login", Login.loginSessionVariables.get("login_matchProxyPerson").get))
.feed(accountIdPayloadfeeder)
.pace(gatlingVariableConfig.pace_time)
.exec(
http("T01_ReactMatchProxyPerson")
.post("/v1/match/person")
.headers("#{C_login}")
)
Thanks for the prompt reply, tried the same solution some time abck
selva4
February 3, 2023, 5:00pm
4
headers method accepts only string parameter only , this is problem here
selva4
February 3, 2023, 5:02pm
5
val loginSessionVariables = scala.collection.mutable.MapString, Map[CharSequence,String]
Oh right, indeed, we don’t support this, my bad.
Just wondering why you can’t use this. Seems to me that the Object Login.loginSessionVariables
is an immutable Map[String, Map[String, String]]
http("T01_ReactMatchProxyPerson")
.post("/v1/match/person")
.headers(Map("C_login" -> Login.loginSessionVariables.get("login_matchProxyPerson").get))
No, the core thing is that we currently require to know all the header names statically, before resolving the dynamic parts, including the header values.
So it’s neither possible to have dynamic header names, nor have a dynamic list of headers.
That being said, in the present case, I’m pretty sure that Login.loginSessionVariables.get("login_matchProxyPerson").get
returns a fixed set of headers, and possibly a single one (Authorization
). If that’s the case, it could be implemented differently.
selva4
February 4, 2023, 8:48am
9
your input is required here
@slandelle could you please suggest on how it could be implemented differently.
here is the details, that you are looking
the following lines of codes are in the Login.scala file
var temp=Map[CharSequence,String]
temp+= “x-ziaccesstoken” → session(“C_ziaccesstoken”).as[String]
temp+= “x-ziid” → jwt.getclaims.get(“ziid”)
temp+= “x-zisession” → jwt.getclaims.get(“zisession”)
loginSessionVariables+= name → temp
[/quote]
Something like:
.header("x-ziaccesstoken", "#{C_login.x-ziaccesstoken}")
.header("x-ziid", "#{C_login.x-ziid}")
.header("x-zisession", "#{C_login.x-zisession}")
system
Closed
March 6, 2023, 9:23am
11
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.