0
votes

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)
 }
})
1

1 Answers

0
votes

This is not related to .sign, but your session attribute CaseReference not being interpreted. If you look closely you can see the braces %-encoded in $%7BCaseReference%7D.

Interpretation of the Gatling Expression Language strings happens only when a String is present when an Expression[Something] is needed1.

This bug you wrote is shown exactly in the warning in the documentation above.

I believe you can simply remove session => in your .get, so you are passing in a String rather than a Session => String2. That string will be implicitly converted to Expression[String]. That way Gatling will put the session attribute into the URL.


  1. This happens because of the Scala implicit conversion.
  2. In fact it is Session => Validation[String], because, again, of implicit conversions.