I’m migrating from gatling 2.3 to 3.2 and I have run into an issue with signing and updating a request with form params using a SignatureCalculator.
In gatling 2.3 I could calculate the signature and add a new form parameter with the signature. This form parameter does get added to the sent request.
exec(http("Form params with signature") .post("/with-signature") .headers(Map("Content-Type" -> "application/x-www-form-urlencoded")) .formParam("value", "some-value") .signatureCalculator((request: Request, value: RequestBuilderBase[_]) => { // calculate signature based on form params in the request value.addFormParam("signature", "calculated-signature") () }))
In gatling 3 this no longer seems to be possible. I’ve tried the following but the added form parameter doesn’t get applied to the sent request.
`
exec(http(“Form params with signature”)
.post("/with-signature")
.formParam(“value”, “some-value”)
.sign(new MySignatureCalculator()))
class MySignatureCalculator extends SignatureCalculator {
override def sign(request: Request): Unit = {
val body = request.getBody
val formParams: java.util.List[Param] = body.asInstanceOf[FormUrlEncodedRequestBody].getContent()
// calculate signature based on form params in the request
request.getBody.asInstanceOf[FormUrlEncodedRequestBody].getContent.add(new Param(“signature”, “calculated-signature”))
}
}
`
Has the possibility to update the request body using a signature calculator been intentionally removed from Gatling 3 or is there some other way to achieve this?
I’ve seen there are few posts about the same thing but I haven’t yet seen any clear answer on this question.
Any input on this will be much appreciated.
Thanks!