Gatling 3.1 .1- .sign issue

Hi

I am trying to build a Get request as follows and I would like CaseReference value to be populated via feeder .feed(CaseProviderSeq) but for some reason it’s not picking CaseReference value and printing following for my println statement in .sign statement bellow

PATH KJ: /caseworkers/554355/jurisdictions/EMPLOYMENT/case-types/Manchester_Multiples/cases/$%7BCaseReference%7D/event-triggers/updateBulkAction_v2/token

My feeder CSV got following rows currently

1574761472170530
1574622770056940

so I am expecting this amended URL would be like /caseworkers/554355/jurisdictions/EMPLOYMENT/case-types/Manchester_Multiples/cases/1574761472170530/event-triggers/updateBulkAction_v2/token

any idea what wrong I am doing here ??

.get(session => SaveEventUrl.replace(":case_reference","${CaseReference}").replaceAll("events", "") + s"event-triggers/${EventId}/token")
.header("ServiceAuthorization", s2sToken)
.header("Authorization", userToken)
.header("Content-Type","application/json")
 .sign(new SignatureCalculator {
   override def sign(request: Request): Unit = {
     val path = request.getUri.getPath
     println("PATH KJ: " + path)
     request.getHeaders.add("uri", path)
   }
 })


Thanks 
KJ

Hello Stephane,

Can you suggest me on this please ?

Regards

Does the CSV file have a header line with “CaseReference” as the first value? Without that, the feeder doesn’t know what session variable to put the read value into, so it puts it into some default value, which I’m sure is not what you are looking for.

Hi John,

Yes csv file header name is CaseReference with following value

1574761472170530
1574622770056940

I would like to change the GET URL with above CaseReference on each iteration before it cross the wire but I think I am not doing some thing right in .sign method

Okay, looking closer, you can’t put ${variable} in a string inside of a session function that expects a string and have it be automatically expanded. Where you have "${CaseReference}" replace that with session("CaseReference").as[String] and it should do what you intended it to do.